#define LOG_TAG "TCAM_HAL"
#define LOG_NDEBUG 0
#include "Tcam.h"

#include <android-base/properties.h>
#include <android-base/strings.h>

#include "asn/BookTravelGet.h"
#include "asn/BookTravelSet.h"
#include "asn/CallBackSts.h"
#include "asn/ETAInfo.h"
#include "asn/GIDProfIDLnk.h"
#include "asn/IHUStatusReport.h"
#include "asn/LightShowMode.h"
#include "asn/LocalBookChrgn.h"
#include "asn/MUTECommand.h"
#include "asn/MasterTcamExtIp.h"
#include "asn/POIInfoPush.h"
#include "asn/PremiumAudio.h"
#include "asn/PrivateLockCntr.h"
#include "asn/PrivateLockPassword.h"
#include "asn/RVDCAuthorizationStatusNotification.h"
#include "asn/RVDCAuthorizationStatusRequest.h"
#include "asn/RVDCAuthorizationStatusUserUpdate.h"
#include "asn/RVDCLanguageSettings.h"
#include "asn/RemoteBookChrgn.h"
#include "asn/RemoteBookTrvlSetgSyncn.h"
#include "asn/RequestExternalTcamlp.h"
#include "asn/SettingParamsRequest.h"
#include "asn/SlaveTcamExtIp.h"
#include "asn/XCallControl.h"
#include "asn/XCallStatus.h"
#include "rtxsrc/rtxCommon.h"
#include "asn/VehicleVideoByChatCamera.h"
#include "asn/SecRowFacialRecognition.h"
#include "asn/CallcenterPre.h"
#include "asn/ChargnStartTimeSyncn.h"
#include "asn/ReservationChrgnSet.h"
#include "asn/RemoteReservationChrgnSetgGet.h"
#include "asn/RemoteReservationChrgnSetSyn.h"
#include "asn/SingleReservationChrgnEnd.h"
#include "asn/LocalReservationChrgnSet.h"
#include "asn/ReservationChrgnSetgGet.h"
#include "asn/RemoteReservationChrgnSetgSyncn.h"

using vendor::ecarx::xma::automotive::vehicle::V2_0::CarModSts1;
using vendor::ecarx::xma::automotive::vehicle::V2_0::UsgModSts1;

namespace vendor {
namespace ecarx {
namespace xma {
namespace tcam {
namespace V1_0 {

const struct { milliseconds common = 10ms; } gDefaultDelay;
Tcam* Tcam::sTcam = nullptr;
sp<IVehicle> mIVehicle = nullptr;

void init_electricpower_side(ipcp_transport_conf_t* clientConfig);
void electricpower_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void electricpower_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_xcall_side(ipcp_transport_conf_t* clientConfig);
void xcall_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void xcall_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_rvdc_side(ipcp_transport_conf_t* clientConfig);
void rvdc_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void rvdc_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_privatelocking(ipcp_transport_conf_t* clientConfig);
void privatelocking_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void privatelocking_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_lightshow(ipcp_transport_conf_t* clientConfig);
void lightshow_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void lightshow_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_gidprof(ipcp_transport_conf_t* clientConfig);
void gidprof_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void gidprof_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_book(ipcp_transport_conf_t* clientConfig);
void book_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void book_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_vehiclevideo(ipcp_transport_conf_t* clientConfig);
void vehiclevideo_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void vehiclevideo_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void init_sec_row_facial_recognition(ipcp_transport_conf_t* clientConfig);
void sec_row_facial_recognition_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error);
void sec_row_facial_recognition_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer);

void setupElectricpower();
void setupXCall();
void setupRvdc();
void setupPrivateLocking();
void setupLightShow();
void setupGidProf();
void setupBook();
void setupVehicleVideo();
void setupSecRowFacialRecognition();

int init_vehicle_server();

int mPrivateLockCTRHandleId = 0;
int mPrivateLockPasswordHandleId = 0;
int mAudioStatusHandleId = 0;
int mPlayChatVideoHandleId = 0;
int mStopChatVideoHandleId = 0;
// const unsigned int DTC_FLAG_STATE = 1;
// const int32_t DTC_CODE = 0xD0AB00;
const int ENCODE_SUCCESS = 0;

uint16_t Charging_OperationIDs[13] = {OP_ID_ELECTRICALPOWER_LOCALBOOKCHRGN,
                                     OP_ID_ELECTRICALPOWER_REMOTEBOOKCHRGN,
                                     OP_ID_ELECTRICALPOWER_REQUESTCHRGN,
                                     OP_ID_ELECTRICALPOWER_BOOK_CHRGN_RESP,
                                     OP_ID_ELECTRICALPOWER_LOCAL_RESERVATION_CHRGN_SET,
                                     OP_ID_ELECTRICALPOWER_RESERVATION_CHARGN_SETG_GET,
                                     OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_SYNCN,
                                     OP_ID_ELECTRICALPOWER_SINGLE_RESERVATION_CHRGN_END,
                                     OP_ID_ELECTRICALPOWER_RESERVATION_CHRGN_SET,
                                     OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_GET,
                                     OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SET_SYN,
                                     OP_ID_ELECTRICALPOWER_RESERVATION_CHARGN_STS_CHANGE_BY_CONFLICT,
                                     OP_ID_ELECTRICALPOWER_BOOKTRVLSTS_CHANGE_BY_CONFLICT};

uint16_t XCALL_OperationIDs[9] = {OP_ID_XCALL_XCALL_STATUS,  OP_ID_XCALL_IHUSTATUS_REPORT,
                                  OP_ID_XCALL_XCALL_CONTROL, OP_ID_XCALL_MUTE_COMMAND,
                                  OP_ID_XCALL_CALL_CENTER_PRE, OP_ID_XCALL_POIINFO_PUSH,
                                  OP_ID_XCALL_CALLBACKSTS, OP_ID_XCALL_ETAINFO,
                                  OP_ID_XCALL_PREMIUM_AUDIO};

uint16_t RVDC_OperationIDs[4] = {OP_ID_RVDC_LANGSETTINGS, OP_ID_RVDC_AUTHORIZATION_STATUS_REQUEST,
                                 OP_ID_RVDC_AUTHORIZATION_STATUS_NOTIFICATION,
                                 OP_ID_RVDC_AUTHORIZATION_STATUS_USER_UPDATE};

uint16_t PrivateLocking_OperationIDs[2] = {OP_ID_PRIVATELOCKING_CNTR, OP_ID_PRIVATELOCKING_PWD};

uint16_t ExteriorLightShow_OperationIDs[4] = {OP_ID_REQUEST_EXTERNAL_TCAM_IP, OP_ID_SLAVE_TCAM_EX_IP,
                                              OP_ID_MASTER_TCAM_EX_IP, OP_ID_LIGHT_SHOW_MODE};

uint16_t GidProf_OperationIDs[1] = {OP_ID_GIDPROFIDLNK};

uint16_t Book_OperationIDs[4] = {OP_ID_BOOK_TRAVEL_GET, OP_ID_BOOK_TRAVEL_SET,
                                 OP_ID_REMOTE_BOOK_TRAVEL_GET, OP_ID_CHARG_START_TIME_SYNC};

uint16_t VehicleVideo_OperationIDs[4] = {OP_ID_PLAY_CHAT_VIDEO_LIVEVIEW, OP_ID_STOP_CHAT_VIDEO_LIVEVIEW,
                                 OP_ID_REMOTE_CHAT_VIDEO_TIMEOUT, OP_ID_REMOTE_CHAT_VIDEO_TIOUT_NOTIF};

uint16_t SecRowFacialRecognition_OperationIDs[6] = {OP_ID_SEC_ROW_FACE_REGISTER, OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_CENTER,
                                 OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_RE, OP_ID_SEC_ROW_FACE_RECOGNITION_REQ,
                                 OP_ID_SEC_ROW_FACE_INFO_CNCL_GID, OP_ID_SEC_ROW_FACE_INFO_UPLOAD_FB};

ipcp_callbacks_t electricpower_callbacks = {
    .ipcp_received_cb = electricpower_received_cb,
    .error_cb = electricpower_error_cb,
};

ipcp_callbacks_t xcall_callbacks = {
    .ipcp_received_cb = xcall_received_cb,
    .error_cb = xcall_error_cb,
};

ipcp_callbacks_t rvdc_callbacks = {
    .ipcp_received_cb = rvdc_received_cb,
    .error_cb = rvdc_error_cb,
};

ipcp_callbacks_t privatelocking_callback = {
    .ipcp_received_cb = privatelocking_receive_cb,
    .error_cb = privatelocking_error_cb,
};

ipcp_callbacks_t lightshow_callback = {
    .ipcp_received_cb = lightshow_receive_cb,
    .error_cb = lightshow_error_cb,
};

ipcp_callbacks_t gidprof_callback = {
    .ipcp_received_cb = gidprof_receive_cb,
    .error_cb = gidprof_error_cb,
};

ipcp_callbacks_t book_callback = {
    .ipcp_received_cb = book_receive_cb,
    .error_cb = book_error_cb,
};

ipcp_callbacks_t vehiclevideo_callback = {
    .ipcp_received_cb = vehiclevideo_receive_cb,
    .error_cb = vehiclevideo_error_cb,
};

ipcp_callbacks_t sec_row_facial_recognition_callback = {
    .ipcp_received_cb = sec_row_facial_recognition_receive_cb,
    .error_cb = sec_row_facial_recognition_error_cb,
};

static ipcp_peer_t peer_electricpower_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_ELECTRICALPOWER,
};

static ipcp_peer_t peer_xcall_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_XCALL,
};

static ipcp_peer_t peer_rvdc_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_RVDC,
};

static ipcp_peer_t peer_privatelocking_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_PRIVATE_LOCKING,
};

static ipcp_peer_t peer_lightshow_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_LIGHT_SHOW,
};

static ipcp_peer_t peer_gidprof_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_GID_PROF,
};

static ipcp_peer_t peer_book_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_BOOK_TRAVEL,
};

static ipcp_peer_t peer_vehiclevideo_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_VEHICLE_VIDEO_BY_CHAT_CAMERA,
};

static ipcp_peer_t peer_sec_row_facial_recognition_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_IP,
    .peer_port = PORT_SEC_ROW_FACIAL_RECOGNITION,
};

static ipcp_peer_t peer_dmm_sec_row_facial_recognition_server = {
    .sk_type = IPCP_TRANSPORT_UDP,
    .peer_ip = PEER_DMM_IP,
    .peer_port = PORT_SEC_ROW_FACIAL_RECOGNITION,
};

void init_electricpower_side(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_ELECTRICALPOWER;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_ELECTRICALPOWER;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_xcall_side(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_XCALL;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_XCALL;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 4;
    clientConfig->priority = 3;
}

void init_rvdc_side(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_RVDC;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_RVDC;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_privatelocking(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_PRIVATELOCKING;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_PRIVATE_LOCKING;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_lightshow(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_LIGHT_SHOW;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_LIGHT_SHOW;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_gidprof(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_GID_PROF;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_GID_PROF;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_book(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_BOOK_TRAVEL;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_BOOK_TRAVEL;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_vehiclevideo(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_VEHICLE_VIDEO_BY_CHAT_CAMERA;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_VEHICLE_VIDEO_BY_CHAT_CAMERA;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void init_sec_row_facial_recognition(ipcp_transport_conf_t* clientConfig) {
    clientConfig->service_id = SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION;
    strcpy(clientConfig->host_ip, LOCAL_IP);
    clientConfig->host_port = PORT_SEC_ROW_FACIAL_RECOGNITION;
    clientConfig->sk_type = IPCP_TRANSPORT_UDP;
    clientConfig->vlan = 2;
    clientConfig->priority = 0;
}

void book_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("book recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("book error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupBook();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("book error_cb STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("book error_cb STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("lightshow error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("book_error_cb unkonw error");
            break;
    }
}

void gidprof_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("gidprof recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("gidprof error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupGidProf();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("gidprof error_cb STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("gidprof error_cb STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("lightshow error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("gidprof_error_cb unkonw error");
            break;
    }
}

void lightshow_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("lightshow recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("lightshow error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupLightShow();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("lightshow error_cb STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("lightshow error_cb STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("lightshow error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("lightshow_error_cb unkonw error");
            break;
    }
}

void electricpower_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("electricpower recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("electricpower error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupElectricpower();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("electricpower error_cb STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("electricpower error_cb STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("electricpower error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            sp<Tcam> tcam = Tcam::getTcam();
            if (tcam != nullptr) {
                tcam->reportDtc();
            }
            break;
        }
        default:
            ALOGE("electricpower_error_cb unkonw error");
            break;
    }
}

void xcall_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("xcall recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("xcall error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupXCall();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("xcall STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("xcall STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("xcall error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("xcall_error_cb unkonw error");
            break;
    }
}

void rvdc_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("rvdc recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("rvdc error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupRvdc();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("rvdc STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("rvdc STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("rvdc error_cb DIAG_ERROR");
            sp<Tcam> tcam = Tcam::getTcam();
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("rvdc_error_cb unkonw error");
            break;
    }
}

void privatelocking_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("privatelocking recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("privatelocking error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupPrivateLocking();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("privatelocking STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("privatelocking STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("privatelocking error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("privatelocking_error_cb unkonw error");
            break;
    }
}

void vehiclevideo_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("vehicle video recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("vehicle video error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupVehicleVideo();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("vehiclevideo STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("vehiclevideo STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("vehiclevideo error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("vehivlevideo_error_cb unkonw error");
            break;
    }
}

void sec_row_facial_recognition_error_cb(ipcp_packet_t* ipcp_packet, ipcp_stack_err_t error) {
    ALOGI("sec row facial recog video recv error_cb... %d", error);
    switch (error) {
        case STACK_FAILURE_CREATE_SOCKET:
        case STACK_FAILURE_SET_VLAN:
        case STACK_FAILURE_BIND_SOCKET:
        case STACK_FAILURE_LISTEN_SOCKET:
        case STACK_FAILURE_ACCEPT_SOCKET:
        case STACK_FAILURE_CONNECT_SOCKET:
        case STACK_FAILURE_CREATE_THREAD:
            ALOGE("sec row facial recog video error_cb socket");
            //ipcp_cleanup();
            sleep(2);
            setupSecRowFacialRecognition();
            break;
        case STACK_FAILURE_WFA_TIMEOUT:
            ALOGE("sec row facial recog video STACK_FAILURE_WFA_TIMEOUT");
            break;
        case STACK_FAILURE_WFR_TIMEOUT:
            ALOGE("sec row facial recog video STACK_FAILURE_WFR_TIMEOUT");
            break;
        case DIAG_ERROR_Code_Invalid_Protocl_Version:
        case DIAG_ERROR_CODE_SERVICE_ID_NOT_AVAILABLE:
        case DIAG_ERROR_Code_OperationID_Not_Available:
        case DIAG_ERROR_Code_OperationType_Not_Available:
        case DIAG_ERROR_Code_Invalid_Length: {
            ALOGE("sec row facial recog video  error_cb DIAG_ERROR");
            // todo 暂时注释，等DTC功能实现后进行确认
            // sp<Tcam> tcam = Tcam::getTcam();
            // if (tcam != nullptr) {
            //   tcam->reportDtc();
            //}
            break;
        }
        default:
            ALOGE("sec_row_facial_recognition_error_cb unkonw error");
            break;
    }
}

IpAddress handleIpAddress(const int count, const OSOCTET data[]) {
    IpAddress ipAddr;
    string str;
    ipAddr.num = count;
    for (auto i = 0; i < count; i++) {
        str.append(std::to_string(data[i]));
        if (i != (count - 1)) {
            str.append(".");
        }
    }
    ipAddr.addr = str;
    return ipAddr;
}

SecRowfaceInfoAcqGid handleSecRowfaceInfoAcqGid(const int count, const OSOCTET data[]) {
    SecRowfaceInfoAcqGid secRowfaceInfoAcqGid;
    string str;
    secRowfaceInfoAcqGid.num = count;
    for (auto i = 0; i < count; i++) {
        str.append(std::to_string(data[i]));
    }
    secRowfaceInfoAcqGid.data = str;
    return secRowfaceInfoAcqGid;
}

SecRowFaceInfoRespGid handleSecRowFaceInfoRespGid(const int count, const OSOCTET data[]) {
    SecRowFaceInfoRespGid secRowFaceInfoRespGid;
    string str;
    secRowFaceInfoRespGid.num = count;
    for (auto i = 0; i < count; i++) {
        str.append(std::to_string(data[i]));
    }
    secRowFaceInfoRespGid.data = str;
    return secRowFaceInfoRespGid;
}

SecRowFaceInfoResp handleSecRowFaceInfoResp(const int count, const OSOCTET data[]) {
    SecRowFaceInfoResp secRowFaceInfoResp;
    string str;
    secRowFaceInfoResp.num = count;
    for (auto i = 0; i < count; i++) {
        str.append(std::to_string(data[i]));
    }
    secRowFaceInfoResp.data = str;
    return secRowFaceInfoResp;
}

FirstRowfaceInfosynImg handleFirstRowfaceInfosynImg(const int count, const OSOCTET data[]) {
    FirstRowfaceInfosynImg firstRowfaceInfosynImg;
    string str;
    firstRowfaceInfosynImg.num = count;
    for (auto i = 0; i < count; i++) {
        str.append(std::to_string(data[i]));
    }
    firstRowfaceInfosynImg.data = str;
    return firstRowfaceInfosynImg;
}

void gidprof_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("gidprof_receive_cb recv_cb... ");
    ipcp_header_t* header = &packet->header;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-----------------gidprof receive package info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
}

void book_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("book recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<--------------------book receive package info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_BOOK_TRAVEL_GET == header->operation_id) {
        ALOGI("%s: OP_ID_BOOK_TRAVEL_GET Start", __func__);
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpBookTravelGet_Response data;
                ASN1C_OpBookTravelGet_Response OpBookTravelGet_Response(decodeBuffer, data);
                if (OpBookTravelGet_Response.Decode()) {
                    ALOGE("%s: OpBookTravelGet_Response decode error", __func__);
                } else {
                    ALOGV("%s: OpBookTravelGet_Response decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookTravelGetResponse setBookTravelInfo;

                            if (::SwtSts::on == data.bookTravelGetResponse.bookTravelCycleSwitch) {
                                setBookTravelInfo.bookTravelSwitch = SwtSts::on;
                            } else if (::SwtSts::off == data.bookTravelGetResponse.bookTravelCycleSwitch) {
                                setBookTravelInfo.bookTravelSwitch = SwtSts::off;
                            }
                            ALOGD("%s: bookTravelCycleSwitch: %d", __func__,
                                data.bookTravelGetResponse.bookTravelCycleSwitch);

                            if (data.bookTravelGetResponse.bookTravelOneDaySet.count > 0) {
                                std::vector<BookTravelOneDaySet> bookTravelOneDaySetList;
                                ASN1C_BookTravelGetResponse_bookTravelOneDaySet bookTravelOneDaygetlist(
                                    data.bookTravelGetResponse.bookTravelOneDaySet);
                                auto bookTravellist = bookTravelOneDaygetlist.iterator();
                                while (bookTravellist->hasNext()) {
                                    auto bookTravelOneDaySet_info =
                                        static_cast<ASN1T_BookTravelOneDaySet*>(
                                            bookTravellist->next());
                                    BookTravelOneDaySet bookTravelInfo;
                                    if (::SelectedDay::noset == bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::noset;
                                    } else if (::SelectedDay::monday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::monday;
                                    } else if (::SelectedDay::tuesday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::tuesday;
                                    } else if (::SelectedDay::wednesday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::wednesday;
                                    } else if (::SelectedDay::thursday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::thursday;
                                    } else if (::SelectedDay::friday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::friday;
                                    } else if (::SelectedDay::saturday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::saturday;
                                    } else if (::SelectedDay::sunday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::sunday;
                                    }
                                    if (bookTravelOneDaySet_info->selectedSts) {
                                        bookTravelInfo.selectedStatus = SelectedStatus::on;
                                    } else {
                                        bookTravelInfo.selectedStatus = SelectedStatus::off;
                                    }
                                    Utils::Asn2DateTime(bookTravelOneDaySet_info->travelTime,
                                                        bookTravelInfo.travelTime);

                                    bookTravelOneDaySetList.push_back(bookTravelInfo);
                                    ALOGD("%s: DailyTravel:         %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d  Week(1~7): %d  Selected: %d", __func__,
                                        bookTravelOneDaySet_info->travelTime.year, bookTravelOneDaySet_info->travelTime.month,
                                        bookTravelOneDaySet_info->travelTime.day, bookTravelOneDaySet_info->travelTime.hour,
                                        bookTravelOneDaySet_info->travelTime.minute, bookTravelOneDaySet_info->travelTime.second,
                                        bookTravelOneDaySet_info->travelTime.dateOrTime,
                                        bookTravelOneDaySet_info->day, bookTravelOneDaySet_info->selectedSts);
                                }
                                setBookTravelInfo.dataList = bookTravelOneDaySetList;
                            }

                            if (::SwtSts::on ==
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSwitch) {
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch =
                                    SwtSts::on;
                            } else if (::SwtSts::off ==
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSwitch) {
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch =
                                    SwtSts::off;
                            }
                            ALOGD("%s: ValleyTimeSwitch: %d", __func__,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSwitch);
                            Utils::Asn2DateTime(
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet
                                    .valleyTime_Start,
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.startValleyTime);
                            ALOGD("%s: ValleyTime_Start:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.year,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.month,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.day,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.hour,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.minute,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.second,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_Start.dateOrTime);
                            Utils::Asn2DateTime(
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet
                                    .valleyTime_End,
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.stopValleyTime);
                            ALOGD("%s: ValleyTime_End:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.year,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.month,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.day,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.hour,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.minute,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.second,
                                data.bookTravelGetResponse.bookTravelChargeValleyTimeSet.valleyTime_End.dateOrTime);

                            if (::SwtSts::on ==
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporarySwitch) {
                                setBookTravelInfo.bookTravelTemporarySet.temporarySwitch =
                                    SwtSts::on;
                            } else if (::SwtSts::off ==
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporarySwitch) {
                                setBookTravelInfo.bookTravelTemporarySet.temporarySwitch =
                                    SwtSts::off;
                            }
                            ALOGD("%s: TemporarySwitch: %d", __func__,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporarySwitch);
                            Utils::Asn2DateTime(
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime,
                                setBookTravelInfo.bookTravelTemporarySet.temporaryTravelTime);
                            ALOGD("%s: TemporaryTravelTime: %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.year,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.month,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.day,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.hour,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.minute,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.second,
                                data.bookTravelGetResponse.bookTravelTemporarySet.temporaryTravelTime.dateOrTime);

                            if (::SwtSts::on == data.bookTravelGetResponse.battPreHeatgActvdSts) {
                                setBookTravelInfo.battPreHeatgActvdSts = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.bookTravelGetResponse.battPreHeatgActvdSts) {
                                setBookTravelInfo.battPreHeatgActvdSts = SwtSts::off;
                            }
                            if (::BattPreHeatgLvl::eco ==
                                data.bookTravelGetResponse.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::eco;
                            } else if (::BattPreHeatgLvl::not_Active ==
                                       data.bookTravelGetResponse.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::notActive;
                            } else if (::BattPreHeatgLvl::sport ==
                                       data.bookTravelGetResponse.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::sport;
                            }
                            if (::SwtSts::on == data.bookTravelGetResponse.bookTrvlClimaActvdSts) {
                                setBookTravelInfo.bookTrvlClimaActvdSts = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.bookTravelGetResponse.bookTrvlClimaActvdSts) {
                                setBookTravelInfo.bookTrvlClimaActvdSts = SwtSts::off;
                            }

                            Utils::Asn2DateTime(
                                data.bookTravelGetResponse.chargnStartTimeSyncn,
                                setBookTravelInfo.chargnStartTimeSyncn);
                            ALOGD("%s: ChargnStartTimeSyncn: %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.year,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.month,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.day,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.hour,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.minute,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.second,
                                data.bookTravelGetResponse.chargnStartTimeSyncn.dateOrTime);

                            ALOGD("%s: BattPreHeatgActvdSts: %d", __func__,
                                data.bookTravelGetResponse.battPreHeatgActvdSts);
                            ALOGD("%s: BattPreHeatgLvl: %d", __func__,
                                data.bookTravelGetResponse.battPreHeatgLvl);
                            ALOGD("%s: BookTrvlClimaActvdSts: %d", __func__,
                                data.bookTravelGetResponse.bookTrvlClimaActvdSts);
                            ALOGD("%s: battPreHeatgLvlPresent: %d", __func__,
                                data.bookTravelGetResponse.m.battPreHeatgLvlPresent);
                            ALOGD("%s: bookTravelChargeValleyTimeSetPresent: %d", __func__,
                                data.bookTravelGetResponse.m.bookTravelChargeValleyTimeSetPresent);
                            ALOGD("%s: bookTravelOneDaySetPresent: %d", __func__,
                                data.bookTravelGetResponse.m.bookTravelOneDaySetPresent);
                            ALOGD("%s: bookTravelTemporarySetPresent: %d", __func__,
                                data.bookTravelGetResponse.m.bookTravelTemporarySetPresent);
                            ALOGD("%s: bookTravelCycleSwitchPresent: %d", __func__,
                                data.bookTravelGetResponse.m.bookTravelCycleSwitchPresent);
                            ALOGD("%s: bookTravelChargeValleyTimeSwitchPresent: %d", __func__,
                                data.bookTravelGetResponse.m.bookTravelChargeValleyTimeSwitchPresent);
                            ALOGD("%s: chargnStartTimeSyncnPresent: %d", __func__,
                                data.bookTravelGetResponse.m.chargnStartTimeSyncnPresent);

                            setBookTravelInfo.battPreHeatgLvlPresent = data.bookTravelGetResponse.m.battPreHeatgLvlPresent;
                            setBookTravelInfo.bookTravelChargeValleyTimeSetPresent = data.bookTravelGetResponse.m.bookTravelChargeValleyTimeSetPresent;
                            setBookTravelInfo.bookTravelOneDaySetPresent = data.bookTravelGetResponse.m.bookTravelOneDaySetPresent;
                            setBookTravelInfo.bookTravelTemporarySetPresent = data.bookTravelGetResponse.m.bookTravelTemporarySetPresent;
                            setBookTravelInfo.bookTravelCycleSwitchPresent = data.bookTravelGetResponse.m.bookTravelCycleSwitchPresent;
                            setBookTravelInfo.bookTravelChargeValleyTimeSwitchPresent = data.bookTravelGetResponse.m.bookTravelChargeValleyTimeSwitchPresent;
                            setBookTravelInfo.chargnStartTimeSyncnPresent = data.bookTravelGetResponse.m.chargnStartTimeSyncnPresent;
                            callback->onBookTravelResponse(setBookTravelInfo);
                        }
                    }
                }

                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("book_receive_cb unkonw op_type");
                break;
        }
        ALOGI("%s: OP_ID_BOOK_TRAVEL_GET End", __func__);
    } else if (OP_ID_BOOK_TRAVEL_SET == header->operation_id) {
        ALOGI("%s: OP_ID_BOOK_TRAVEL_SET Start", __func__);
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpBookTravelSet_Response data;
                ASN1C_OpBookTravelSet_Response OpBookTravelSet_Respons(decodeBuffer, data);
                if (OpBookTravelSet_Respons.Decode()) {
                    ALOGE("%s: OpBookTravelSet_Respons decode error", __func__);
                } else {
                    ALOGV("%s: OpBookTravelSet_Respons decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookTravelSetResponse bookTravelSetResponse =
                                BookTravelSetResponse::defaultValue;
                            if (::BookTravelSetResponse::default_ == data.bookTravelSetResponse) {
                                bookTravelSetResponse = BookTravelSetResponse::defaultValue;
                            } else if (::BookTravelSetResponse::success ==
                                       data.bookTravelSetResponse) {
                                bookTravelSetResponse = BookTravelSetResponse::success;
                            } else if (::BookTravelSetResponse::fail == data.bookTravelSetResponse) {
                                bookTravelSetResponse = BookTravelSetResponse::fail;
                            }
                            ALOGV("%s: OP_ID_BOOK_TRAVEL_SET bookTravelSetResponse Result: %d", __func__, 
                                bookTravelSetResponse);
                            callback->onBookTravelSetResponse(bookTravelSetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("OP_ID_BOOK_TRAVEL_SET unkonw op_type");
                break;
        }
        ALOGI("%s: OP_ID_BOOK_TRAVEL_SET End", __func__);
    } else if (OP_ID_REMOTE_BOOK_TRAVEL_GET == header->operation_id) {
        ALOGI("%s: OP_ID_REMOTE_BOOK_TRAVEL_GET Start", __func__);
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRemoteBookTrvlSetgSyncn_Notification data;
                ASN1C_OpRemoteBookTrvlSetgSyncn_Notification OpRemoteBookTrvlSetgSyncn_Notification(
                    decodeBuffer, data);
                if (OpRemoteBookTrvlSetgSyncn_Notification.Decode()) {
                    ALOGE("%s: OpRemoteBookTrvlSetgSyncn_Notification decode error", __func__);
                } else {
                    ALOGV("%s: OpRemoteBookTrvlSetgSyncn_Notification decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookTravelGetResponse setBookTravelInfo;
                            if (::SwtSts::on == data.remoteBookTrvlSetgSyncn.bookTravelCycleSwitch) {
                                setBookTravelInfo.bookTravelSwitch = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.remoteBookTrvlSetgSyncn.bookTravelCycleSwitch) {
                                setBookTravelInfo.bookTravelSwitch = SwtSts::off;
                            }
                            ALOGD("%s: bookTravelCycleSwitch: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelCycleSwitch);

                            if (data.remoteBookTrvlSetgSyncn.bookTravelOneDaySet.count > 0) {
                                std::vector<BookTravelOneDaySet> bookTravelOneDaySetList;
                                ASN1C_BookTravelGetResponse_bookTravelOneDaySet bookTravelOneDaygetlist(
                                    data.remoteBookTrvlSetgSyncn.bookTravelOneDaySet);
                                auto bookTravellist = bookTravelOneDaygetlist.iterator();
                                while (bookTravellist->hasNext()) {
                                    auto bookTravelOneDaySet_info =
                                        static_cast<ASN1T_BookTravelOneDaySet*>(
                                            bookTravellist->next());
                                    BookTravelOneDaySet bookTravelInfo;
                                    if (::SelectedDay::noset == bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::noset;
                                    } else if (::SelectedDay::monday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::monday;
                                    } else if (::SelectedDay::tuesday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::tuesday;
                                    } else if (::SelectedDay::wednesday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::wednesday;
                                    } else if (::SelectedDay::thursday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::thursday;
                                    } else if (::SelectedDay::friday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::friday;
                                    } else if (::SelectedDay::saturday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::saturday;
                                    } else if (::SelectedDay::sunday ==
                                               bookTravelOneDaySet_info->day) {
                                        bookTravelInfo.day = SelectedDay::sunday;
                                    }
                                    if (bookTravelOneDaySet_info->selectedSts) {
                                        bookTravelInfo.selectedStatus = SelectedStatus::on;
                                    } else {
                                        bookTravelInfo.selectedStatus = SelectedStatus::off;
                                    }
                                    Utils::Asn2DateTime(bookTravelOneDaySet_info->travelTime,
                                                        bookTravelInfo.travelTime);

                                    bookTravelOneDaySetList.push_back(bookTravelInfo);
                                    ALOGD("%s: DailyTravel:         %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d  Week(1~7): %d  Selected: %d", __func__,
                                        bookTravelOneDaySet_info->travelTime.year, bookTravelOneDaySet_info->travelTime.month,
                                        bookTravelOneDaySet_info->travelTime.day, bookTravelOneDaySet_info->travelTime.hour,
                                        bookTravelOneDaySet_info->travelTime.minute, bookTravelOneDaySet_info->travelTime.second,
                                        bookTravelOneDaySet_info->travelTime.dateOrTime,
                                        bookTravelOneDaySet_info->day, bookTravelOneDaySet_info->selectedSts);
                                }
                                setBookTravelInfo.dataList = bookTravelOneDaySetList;
                            }

                            if (::SwtSts::on == data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSwitch) {
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSwitch) {
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch = SwtSts::off;
                            }
                            ALOGD("%s: bookTravelChargeValleyTimeSwitch: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSwitch);
                            Utils::Asn2DateTime(
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet
                                    .valleyTime_Start,
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.startValleyTime);
                            ALOGD("%s: ValleyTime_Start:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.year,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.month,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.day,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.hour,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.minute,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.second,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_Start.dateOrTime);
                            Utils::Asn2DateTime(
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet
                                    .valleyTime_End,
                                setBookTravelInfo.bookTravelChargeValleyTimeSet.stopValleyTime);
                            ALOGD("%s: ValleyTime_End:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.year,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.month,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.day,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.hour,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.minute,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.second,
                                data.remoteBookTrvlSetgSyncn.bookTravelChargeValleyTimeSet.valleyTime_End.dateOrTime);
                            if (::SwtSts::on ==
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporarySwitch) {
                                setBookTravelInfo.bookTravelTemporarySet.temporarySwitch =
                                    SwtSts::on;
                            } else if (::SwtSts::off == 
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporarySwitch) {
                                setBookTravelInfo.bookTravelTemporarySet.temporarySwitch =
                                    SwtSts::off;
                            }
                            ALOGD("%s: TemporarySwitch: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporarySwitch);
                            Utils::Asn2DateTime(
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet
                                    .temporaryTravelTime,
                                setBookTravelInfo.bookTravelTemporarySet.temporaryTravelTime);
                            ALOGD("%s: TemporaryTravelTime: %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.year,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.month,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.day,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.hour,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.minute,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.second,
                                data.remoteBookTrvlSetgSyncn.bookTravelTemporarySet.temporaryTravelTime.dateOrTime);
                            if (::SwtSts::on == data.remoteBookTrvlSetgSyncn.battPreHeatgActvdSts) {
                                setBookTravelInfo.battPreHeatgActvdSts = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.remoteBookTrvlSetgSyncn.battPreHeatgActvdSts) {
                                setBookTravelInfo.battPreHeatgActvdSts = SwtSts::off;
                            }
                            if (::BattPreHeatgLvl::eco ==
                                data.remoteBookTrvlSetgSyncn.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::eco;
                            } else if (::BattPreHeatgLvl::not_Active ==
                                       data.remoteBookTrvlSetgSyncn.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::notActive;
                            } else if (::BattPreHeatgLvl::sport ==
                                       data.remoteBookTrvlSetgSyncn.battPreHeatgLvl) {
                                setBookTravelInfo.battPreHeatgLvl = BattPreHeatgLvl::sport;
                            }
                            if (::SwtSts::on == data.remoteBookTrvlSetgSyncn.bookTrvlClimaActvdSts) {
                                setBookTravelInfo.bookTrvlClimaActvdSts = SwtSts::on;
                            } else if (::SwtSts::off ==
                                       data.remoteBookTrvlSetgSyncn.bookTrvlClimaActvdSts) {
                                setBookTravelInfo.bookTrvlClimaActvdSts = SwtSts::off;
                            }
                            ALOGD("%s: BattPreHeatgActvdSts: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.battPreHeatgActvdSts);
                            ALOGD("%s: BattPreHeatgLvl: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.battPreHeatgLvl);
                            ALOGD("%s: BookTrvlClimaActvdSts: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.bookTrvlClimaActvdSts);

                            ALOGD("%s: battPreHeatgActvdStsPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.battPreHeatgActvdStsPresent);
                            ALOGD("%s: battPreHeatgLvlPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.battPreHeatgLvlPresent);
                            ALOGD("%s: bookTravelChargeValleyTimeSetPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTravelChargeValleyTimeSetPresent);
                            ALOGD("%s: bookTravelOneDaySetPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTravelOneDaySetPresent);
                            ALOGD("%s: bookTravelTemporarySetPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTravelTemporarySetPresent);
                            ALOGD("%s: bookTrvlClimaActvdStsPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTrvlClimaActvdStsPresent);
                            ALOGD("%s: bookTravelCycleSwitchPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTravelCycleSwitchPresent);
                            ALOGD("%s: bookTravelChargeValleyTimeSwitchPresent: %d", __func__,
                                data.remoteBookTrvlSetgSyncn.m.bookTravelChargeValleyTimeSwitchPresent);
                            setBookTravelInfo.battPreHeatgActvdStsPresent = data.remoteBookTrvlSetgSyncn.m.battPreHeatgActvdStsPresent;
                            setBookTravelInfo.battPreHeatgLvlPresent = data.remoteBookTrvlSetgSyncn.m.battPreHeatgLvlPresent;
                            setBookTravelInfo.bookTravelChargeValleyTimeSetPresent = data.remoteBookTrvlSetgSyncn.m.bookTravelChargeValleyTimeSetPresent;
                            setBookTravelInfo.bookTravelOneDaySetPresent = data.remoteBookTrvlSetgSyncn.m.bookTravelOneDaySetPresent;
                            setBookTravelInfo.bookTravelTemporarySetPresent = data.remoteBookTrvlSetgSyncn.m.bookTravelTemporarySetPresent;
                            setBookTravelInfo.bookTrvlClimaActvdStsPresent = data.remoteBookTrvlSetgSyncn.m.bookTrvlClimaActvdStsPresent;
                            setBookTravelInfo.bookTravelCycleSwitchPresent = data.remoteBookTrvlSetgSyncn.m.bookTravelCycleSwitchPresent;
                            setBookTravelInfo.bookTravelChargeValleyTimeSwitchPresent = data.remoteBookTrvlSetgSyncn.m.bookTravelChargeValleyTimeSwitchPresent;
                            callback->onRemoteBookTrvlSetgSyncnResponse(setBookTravelInfo);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("OP_ID_REMOTE_BOOK_TRAVEL_GET unkonw op_type");
                break;
        }
        ALOGI("%s: OP_ID_REMOTE_BOOK_TRAVEL_GET End", __func__);
    } else if (OP_ID_CHARG_START_TIME_SYNC == header->operation_id) {
        ALOGI("%s: OP_ID_CHARG_START_TIME_SYNC Start", __func__);
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpChargnStartTimeSyncn_Notification data;
                ASN1C_OpChargnStartTimeSyncn_Notification OpChargnStartTimeSyncn_Notification(
                    decodeBuffer, data);
                if (OpChargnStartTimeSyncn_Notification.Decode()) {
                    ALOGE("%s: OpChargnStartTimeSyncn_Notification decode error", __func__);
                } else {
                    ALOGV("%s: OpChargnStartTimeSyncn_Notification decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookTravelGetResponse setBookTravelInfo;

                            Utils::Asn2DateTime(
                                data.chargnStartTimeSyncn,
                                setBookTravelInfo.chargnStartTimeSyncn);
                            ALOGD("%s: chargnStartTimeSyncn: %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.chargnStartTimeSyncn.year,
                                data.chargnStartTimeSyncn.month,
                                data.chargnStartTimeSyncn.day,
                                data.chargnStartTimeSyncn.hour,
                                data.chargnStartTimeSyncn.minute,
                                data.chargnStartTimeSyncn.second,
                                data.chargnStartTimeSyncn.dateOrTime);
                            callback->onChargeStartTimeSync(setBookTravelInfo);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("OP_ID_CHARG_START_TIME_SYNC unkonw op_type");
                break;
        }
        ALOGI("%s: OP_ID_CHARG_START_TIME_SYNC End", __func__);
    }
}
void lightshow_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("lightshow recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<--------------lightshow receive package info-------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_REQUEST_EXTERNAL_TCAM_IP == header->operation_id) {
        ALOGI("REQUEST_EXTERNAL_TCAM_IP");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRequestExternalTcamIp_Response data;
                ASN1C_OpRequestExternalTcamIp_Response OpRequestExternalTcamIp_Response(
                    decodeBuffer, data);
                if (OpRequestExternalTcamIp_Response.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onExternalTcamIpResponse(
                                handleIpAddress(data.tcamExternalTcamIPadr.numocts,
                                                data.tcamExternalTcamIPadr.data));
                        }
                    }
                }

                break;
            }
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRequestExternalTcamIp_Response data;
                ASN1C_OpRequestExternalTcamIp_Response OpRequestExternalTcamIp_Response(
                    decodeBuffer, data);
                if (OpRequestExternalTcamIp_Response.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onExternalTcamIpNotify(
                                handleIpAddress(data.tcamExternalTcamIPadr.numocts,
                                                data.tcamExternalTcamIPadr.data));
                        }
                    }
                }

                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("lightshow_receive_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_SLAVE_TCAM_EX_IP == header->operation_id) {
        ALOGI("SLAVE_TCAM_EX_IP");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION_CYC: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpSlaveTcamExtIp_NotificationCyclic data;
                ASN1C_OpSlaveTcamExtIp_NotificationCyclic OpSlaveTcamExtIp_NotificationCyclic(
                    decodeBuffer, data);
                if (OpSlaveTcamExtIp_NotificationCyclic.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    std::vector<IpAddress> ipAddress_list;
                    ASN1C_OpSlaveTcamExtIp_NotificationCyclic_slavetcamExternalIPadr
                        asn1cslavetcamExternalIPadrlist(data.slavetcamExternalIPadr);
                    auto ipAddresList = asn1cslavetcamExternalIPadrlist.iterator();
                    while (ipAddresList->hasNext()) {
                        IpAddress ipAddress;
                        auto ipAddress_info =
                            static_cast<ASN1T_Slavetcam_ExternalIPadr_INFO*>(ipAddresList->next());
                        ipAddress = handleIpAddress(ipAddress_info->tcamExternalTcamIPadr.numocts,
                                                    ipAddress_info->tcamExternalTcamIPadr.data);

                        ipAddress_list.push_back(ipAddress);
                    }
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onSlaveTcamExtIpNotifyCyclic(ipAddress_list);
                        }
                    }
                }

                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("lightshow_receive_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_MASTER_TCAM_EX_IP == header->operation_id) {
        ALOGI("MASTER_TCAM_EX_IP");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION_CYC: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpMasterTcamExtIp_NotificationCyclic data;
                ASN1C_OpMasterTcamExtIp_NotificationCyclic OpMasterTcamExtIp_NotificationCyclic(
                    decodeBuffer, data);
                if (OpMasterTcamExtIp_NotificationCyclic.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    std::vector<IpAddress> ipAddress_list;
                    ASN1C_OpMasterTcamExtIp_NotificationCyclic_mastertcamExternalIPadr
                        asn1cmastertcamExternalIPadrlist(data.mastertcamExternalIPadr);
                    auto ipAddresList = asn1cmastertcamExternalIPadrlist.iterator();
                    while (ipAddresList->hasNext()) {
                        IpAddress ipAddress;
                        auto ipAddress_info =
                            static_cast<ASN1T_Mastertcam_ExternalIPadr_INFO*>(ipAddresList->next());
                        ipAddress = handleIpAddress(ipAddress_info->tcamExternalTcamIPadr.numocts,
                                                    ipAddress_info->tcamExternalTcamIPadr.data);

                        ipAddress_list.push_back(ipAddress);
                    }
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onMasterTcamExtIpNotifyCyclic(ipAddress_list);
                        }
                    }
                }

                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                }
                break;
            }
            default:
                ALOGE("lightshow_receive_cb unkonw op_type");
                break;
        }
    }
}

void electricpower_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("electricpower recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<--------------electricpower receive package info-------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_ELECTRICALPOWER_REMOTEBOOKCHRGN == header->operation_id) {
        ALOGI("ELECTRICALPOWER_REMOTEBOOKCHRGN");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRemoteBookChrgn_Notification data;
                ASN1C_OpRemoteBookChrgn_Notification OpRemoteBookChrgn_NotificationPDU(decodeBuffer,
                                                                                       data);
                if (OpRemoteBookChrgn_NotificationPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            RemoteBookChrgnInfo info;

                            if (0x0 == data.remBookChrgnTmrActvd) {
                                info.remoteBookChrgn = RemoteBookChrgn::OFF;
                            } else if (0x1 == data.remBookChrgnTmrActvd) {
                                info.remoteBookChrgn = RemoteBookChrgn::On;
                            }

                            Utils::Asn2DateTime(data.remBookStrtTiChrgnTmr, info.startTime);
                            Utils::Asn2DateTime(data.remBookStopTiChrgnTmr, info.stopTime);
                            tcam->setTimeProperty(info.startTime, info.stopTime,
                                                  data.remBookChrgnTmrActvd);
                            callback->onRemoteBookChrgnInfoNotification(info);
                        }
                    }
                }

                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onRemoteBookChrgnError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_REQUESTCHRGN == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_REQUESTCHRGN");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpSettingParamsRequest_Response data;
                ASN1C_OpSettingParamsRequest_Response OpSettingParamsRequest_ResponsePDU(
                    decodeBuffer, data);
                if (OpSettingParamsRequest_ResponsePDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            SettingParamsRequestResponse info;

                            if (0x0 == data.bookChrgnActvd) {
                                info.bookChrgnActvd = BookChrgnActvd::OFF;
                            } else if (0x1 == data.bookChrgnActvd) {
                                info.bookChrgnActvd = BookChrgnActvd::On;
                            }

                            Utils::Asn2DateTime(data.bookStrtTiChrgnTmr, info.startTime);
                            Utils::Asn2DateTime(data.bookStopTiChrgnTmr, info.stopTime);
                            tcam->setTimeProperty(info.startTime, info.stopTime,
                                                  data.bookChrgnActvd);
                            callback->onChargingResponse(info);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_LOCALBOOKCHRGN == header->operation_id) {
        ALOGI("ELECTRICALPOWER_LOCALBOOKCHRGN");
        if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onLocalBookChrgnError();
                    }
                }
            }
        }
    } else if (OP_ID_ELECTRICALPOWER_RESERVATION_CHRGN_SET == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_RESERVATION_CHRGN_SET");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpReservationChrgnSet_Response data;
                ASN1C_OpReservationChrgnSet_Response OpReservationChrgnSet_ResponsePDU(
                    decodeBuffer, data);
                if (OpReservationChrgnSet_ResponsePDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingSetResponse bookChargingSetResponse = BookChargingSetResponse::defaultValue;

                            if (::ReservationChrgnSet_LocalReservationChrgnSetResp::default_ == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::defaultValue;
                            } else if (::ReservationChrgnSet_LocalReservationChrgnSetResp::success == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::success;
                            } else if (::ReservationChrgnSet_LocalReservationChrgnSetResp::fail == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::fail;
                            }
                            ALOGV("%s: OP_ID_ELECTRICALPOWER_RESERVATION_CHRGN_SET bookChargingSetResponse Result: %d", __func__,
                                bookChargingSetResponse);
                            callback->onBookChargingSetResponse_Use0x22(bookChargingSetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_LOCAL_RESERVATION_CHRGN_SET == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_LOCAL_RESERVATION_CHRGN_SET");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpLocalReservationChrgnSet_Response data;
                ASN1C_OpLocalReservationChrgnSet_Response OpLocalReservationChrgnSet_ResponsePDU(
                    decodeBuffer, data);
                if (OpLocalReservationChrgnSet_ResponsePDU.Decode()) {
                    ALOGE("OpLocalReservationChrgnSet_ResponsePDU decode error");
                } else {
                    ALOGV("OpLocalReservationChrgnSet_ResponsePDU decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingSetResponse bookChargingSetResponse = BookChargingSetResponse::defaultValue;

                            if (::ReservationChrgnSet_LocalReservationChrgnSetResp::default_ == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::defaultValue;
                            } else if (::ReservationChrgnSet_LocalReservationChrgnSetResp::success == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::success;
                            } else if (::ReservationChrgnSet_LocalReservationChrgnSetResp::fail == data.localReservationChrgnSetResp) {
                                bookChargingSetResponse = BookChargingSetResponse::fail;
                            }
                            ALOGV("%s: OP_ID_ELECTRICALPOWER_LOCAL_RESERVATION_CHRGN_SET bookChargingSetResponse Result: %d", __func__,
                                bookChargingSetResponse);
                            callback->onBookChargingSetResponse_Use0x1C(bookChargingSetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_GET == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_GET");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRemoteReservationChrgnSetgGet_Response data;
                ASN1C_OpRemoteReservationChrgnSetgGet_Response OpRemoteReservationChrgnSetgGet_Response(decodeBuffer, data);
                if (OpRemoteReservationChrgnSetgGet_Response.Decode()) {
                    ALOGE("%s: OpRemoteReservationChrgnSetgGet_Response decode error", __func__);
                } else {
                    ALOGV("%s: OpRemoteReservationChrgnSetgGet_Response decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingGetResponse bookChargingGetResponse;
                            if (::RemoteReservationChrgnSetgGet_ReservationChrgnSwitchSts::off == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::off;
                            } else if (::RemoteReservationChrgnSetgGet_ReservationChrgnSwitchSts::single == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::single;
                            } else if (::RemoteReservationChrgnSetgGet_ReservationChrgnSwitchSts::cycle == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::cycle;
                            }
                            ALOGD("%s: reservationChrgnSwitchSts: %d", __func__, data.reservationChrgnSwitchSts);

                            Utils::Asn2DateTime(data.reservationStrtTiChrgnTmr,bookChargingGetResponse.reservationStrtTiChrgnTmr);
                            ALOGD("%s: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStrtTiChrgnTmr.year,
                                data.reservationStrtTiChrgnTmr.month,
                                data.reservationStrtTiChrgnTmr.day,
                                data.reservationStrtTiChrgnTmr.hour,
                                data.reservationStrtTiChrgnTmr.minute,
                                data.reservationStrtTiChrgnTmr.second,
                                data.reservationStrtTiChrgnTmr.dateOrTime);

                            Utils::Asn2DateTime(data.reservationStopTiChrgnTmr,
                                bookChargingGetResponse.reservationStopTiChrgnTmr);
                            ALOGD("%s: reservationStopTiChrgnTmr:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStopTiChrgnTmr.year,
                                data.reservationStopTiChrgnTmr.month,
                                data.reservationStopTiChrgnTmr.day,
                                data.reservationStopTiChrgnTmr.hour,
                                data.reservationStopTiChrgnTmr.minute,
                                data.reservationStopTiChrgnTmr.second,
                                data.reservationStopTiChrgnTmr.dateOrTime);

                            if (::SwtSts::on == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: priorityFullSwitchSts: %d", __func__,data.priorityFullSwitchSts);

                            if (::SwtSts::on == data.plugInChrgnSwitchSts) {
                                bookChargingGetResponse.plugInChrgnSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.plugInChrgnSwitchSts) {
                                bookChargingGetResponse.plugInChrgnSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: plugInChrgnSwitchSts: %d", __func__,data.plugInChrgnSwitchSts);

                            ALOGD("%s: reservationStrtTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStrtTiChrgnTmrPresent);
                            ALOGD("%s: reservationStopTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStopTiChrgnTmrPresent);
                            ALOGD("%s: priorityFullSwitchStsPresent: %d", __func__,
                                data.m.priorityFullSwitchStsPresent);
                            ALOGD("%s: plugInChrgnSwitchStsPresent: %d", __func__,
                                data.m.plugInChrgnSwitchStsPresent);

                            bookChargingGetResponse.reservationStrtTiChrgnTmrPresent = data.m.reservationStrtTiChrgnTmrPresent;
                            bookChargingGetResponse.reservationStopTiChrgnTmrPresent = data.m.reservationStopTiChrgnTmrPresent;
                            bookChargingGetResponse.priorityFullSwitchStsPresent = data.m.priorityFullSwitchStsPresent;
                            bookChargingGetResponse.plugInChrgnSwitchStsPresent = data.m.plugInChrgnSwitchStsPresent;

                            callback->onBookChargingResponse_Use0x23(bookChargingGetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_RESERVATION_CHARGN_SETG_GET == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_RESERVATION_CHARGN_SETG_GET");
        switch (header->op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpReservationChrgnSetgGet_Response data;
                ASN1C_OpReservationChrgnSetgGet_Response OpReservationChrgnSetgGet_Response(decodeBuffer, data);
                if (OpReservationChrgnSetgGet_Response.Decode()) {
                    ALOGE("%s: OpReservationChrgnSetgGet_Response decode error", __func__);
                } else {
                    ALOGV("%s: OpReservationChrgnSetgGet_Response decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingGetResponse bookChargingGetResponse;
                            if (::ReservationChrgnSetgGet_ReservationChrgnSwitchSts::off == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::off;
                            } else if (::ReservationChrgnSetgGet_ReservationChrgnSwitchSts::single == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::single;
                            } else if (::ReservationChrgnSetgGet_ReservationChrgnSwitchSts::cycle == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::cycle;
                            }
                            ALOGD("%s: reservationChrgnSwitchSts: %d", __func__, data.reservationChrgnSwitchSts);

                            Utils::Asn2DateTime(data.reservationStrtTiChrgnTmr,bookChargingGetResponse.reservationStrtTiChrgnTmr);
                            ALOGD("%s: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStrtTiChrgnTmr.year,
                                data.reservationStrtTiChrgnTmr.month,
                                data.reservationStrtTiChrgnTmr.day,
                                data.reservationStrtTiChrgnTmr.hour,
                                data.reservationStrtTiChrgnTmr.minute,
                                data.reservationStrtTiChrgnTmr.second,
                                data.reservationStrtTiChrgnTmr.dateOrTime);

                            Utils::Asn2DateTime(data.reservationStopTiChrgnTmr,
                                bookChargingGetResponse.reservationStopTiChrgnTmr);
                            ALOGD("%s: reservationStopTiChrgnTmr:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStopTiChrgnTmr.year,
                                data.reservationStopTiChrgnTmr.month,
                                data.reservationStopTiChrgnTmr.day,
                                data.reservationStopTiChrgnTmr.hour,
                                data.reservationStopTiChrgnTmr.minute,
                                data.reservationStopTiChrgnTmr.second,
                                data.reservationStopTiChrgnTmr.dateOrTime);

                            if (::SwtSts::on == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: priorityFullSwitchSts: %d", __func__,data.priorityFullSwitchSts);

                            ALOGD("%s: reservationStrtTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStrtTiChrgnTmrPresent);
                            ALOGD("%s: reservationStopTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStopTiChrgnTmrPresent);
                            ALOGD("%s: priorityFullSwitchStsPresent: %d", __func__,
                                data.m.priorityFullSwitchStsPresent);

                            bookChargingGetResponse.reservationStrtTiChrgnTmrPresent = data.m.reservationStrtTiChrgnTmrPresent;
                            bookChargingGetResponse.reservationStopTiChrgnTmrPresent = data.m.reservationStopTiChrgnTmrPresent;
                            bookChargingGetResponse.priorityFullSwitchStsPresent = data.m.priorityFullSwitchStsPresent;

                            callback->onBookChargingResponse_Use0x1D(bookChargingGetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SET_SYN == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SET_SYN");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRemoteReservationChrgnSetSyn_Notification data;
                ASN1C_OpRemoteReservationChrgnSetSyn_Notification OpRemoteReservationChrgnSetSyn_Notification(decodeBuffer, data);
                if (OpRemoteReservationChrgnSetSyn_Notification.Decode()) {
                    ALOGE("%s: OpRemoteReservationChrgnSetSyn_Notification decode error", __func__);
                } else {
                    ALOGV("%s: OpRemoteReservationChrgnSetSyn_Notification decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingGetResponse bookChargingGetResponse;
                            if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::off == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::off;
                            } else if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::single == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::single;
                            } else if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::cycle == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::cycle;
                            }
                            ALOGD("%s: reservationChrgnSwitchSts: %d", __func__, data.reservationChrgnSwitchSts);

                            Utils::Asn2DateTime(data.reservationStrtTiChrgnTmr,bookChargingGetResponse.reservationStrtTiChrgnTmr);
                            ALOGD("%s: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStrtTiChrgnTmr.year,
                                data.reservationStrtTiChrgnTmr.month,
                                data.reservationStrtTiChrgnTmr.day,
                                data.reservationStrtTiChrgnTmr.hour,
                                data.reservationStrtTiChrgnTmr.minute,
                                data.reservationStrtTiChrgnTmr.second,
                                data.reservationStrtTiChrgnTmr.dateOrTime);

                            Utils::Asn2DateTime(data.reservationStopTiChrgnTmr,
                                bookChargingGetResponse.reservationStopTiChrgnTmr);
                            ALOGD("%s: reservationStopTiChrgnTmr:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStopTiChrgnTmr.year,
                                data.reservationStopTiChrgnTmr.month,
                                data.reservationStopTiChrgnTmr.day,
                                data.reservationStopTiChrgnTmr.hour,
                                data.reservationStopTiChrgnTmr.minute,
                                data.reservationStopTiChrgnTmr.second,
                                data.reservationStopTiChrgnTmr.dateOrTime);

                            if (::SwtSts::on == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: priorityFullSwitchSts: %d", __func__,data.priorityFullSwitchSts);

                            if (::SwtSts::on == data.plugInChrgnSwitchSts) {
                                bookChargingGetResponse.plugInChrgnSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.plugInChrgnSwitchSts) {
                                bookChargingGetResponse.plugInChrgnSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: plugInChrgnSwitchSts: %d", __func__,data.plugInChrgnSwitchSts);

                            ALOGD("%s: reservationStrtTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStrtTiChrgnTmrPresent);
                            ALOGD("%s: reservationStopTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStopTiChrgnTmrPresent);
                            ALOGD("%s: priorityFullSwitchStsPresent: %d", __func__,
                                data.m.priorityFullSwitchStsPresent);
                            ALOGD("%s: plugInChrgnSwitchStsPresent: %d", __func__,
                                data.m.plugInChrgnSwitchStsPresent);

                            bookChargingGetResponse.reservationStrtTiChrgnTmrPresent = data.m.reservationStrtTiChrgnTmrPresent;
                            bookChargingGetResponse.reservationStopTiChrgnTmrPresent = data.m.reservationStopTiChrgnTmrPresent;
                            bookChargingGetResponse.priorityFullSwitchStsPresent = data.m.priorityFullSwitchStsPresent;
                            bookChargingGetResponse.plugInChrgnSwitchStsPresent = data.m.plugInChrgnSwitchStsPresent;

                            callback->onRemoteBookChrgnSetSynNotification_Use0x24(bookChargingGetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    } else if (OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_SYNCN == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_SYNCN");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpRemoteReservationChrgnSetgSyncn_Notification data;
                ASN1C_OpRemoteReservationChrgnSetgSyncn_Notification OpRemoteReservationChrgnSetgSyncn_Notification(decodeBuffer, data);
                if (OpRemoteReservationChrgnSetgSyncn_Notification.Decode()) {
                    ALOGE("%s: OpRemoteReservationChrgnSetgSyncn_Notification decode error", __func__);
                } else {
                    ALOGV("%s: OpRemoteReservationChrgnSetgSyncn_Notification decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            BookChargingGetResponse bookChargingGetResponse;
                            if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::off == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::off;
                            } else if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::single == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::single;
                            } else if (::RemoteReservationChrgnSetSyn_ReservationChrgnSwitchSts::cycle == data.reservationChrgnSwitchSts) {
                                bookChargingGetResponse.reservationChrgnSwitchSts= ReservationChrgnSwitchSts::cycle;
                            }
                            ALOGD("%s: reservationChrgnSwitchSts: %d", __func__, data.reservationChrgnSwitchSts);

                            Utils::Asn2DateTime(data.reservationStrtTiChrgnTmr,bookChargingGetResponse.reservationStrtTiChrgnTmr);
                            ALOGD("%s: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStrtTiChrgnTmr.year,
                                data.reservationStrtTiChrgnTmr.month,
                                data.reservationStrtTiChrgnTmr.day,
                                data.reservationStrtTiChrgnTmr.hour,
                                data.reservationStrtTiChrgnTmr.minute,
                                data.reservationStrtTiChrgnTmr.second,
                                data.reservationStrtTiChrgnTmr.dateOrTime);

                            Utils::Asn2DateTime(data.reservationStopTiChrgnTmr,
                                bookChargingGetResponse.reservationStopTiChrgnTmr);
                            ALOGD("%s: reservationStopTiChrgnTmr:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d", __func__,
                                data.reservationStopTiChrgnTmr.year,
                                data.reservationStopTiChrgnTmr.month,
                                data.reservationStopTiChrgnTmr.day,
                                data.reservationStopTiChrgnTmr.hour,
                                data.reservationStopTiChrgnTmr.minute,
                                data.reservationStopTiChrgnTmr.second,
                                data.reservationStopTiChrgnTmr.dateOrTime);

                            if (::SwtSts::on == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::on;
                            } else if (::SwtSts::off == data.priorityFullSwitchSts) {
                                bookChargingGetResponse.priorityFullSwitchSts = SwtSts::off;
                            }
                            ALOGD("%s: priorityFullSwitchSts: %d", __func__,data.priorityFullSwitchSts);

                            ALOGD("%s: reservationStrtTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStrtTiChrgnTmrPresent);
                            ALOGD("%s: reservationStopTiChrgnTmrPresent: %d", __func__,
                                data.m.reservationStopTiChrgnTmrPresent);
                            ALOGD("%s: priorityFullSwitchStsPresent: %d", __func__,
                                data.m.priorityFullSwitchStsPresent);

                            bookChargingGetResponse.reservationStrtTiChrgnTmrPresent = data.m.reservationStrtTiChrgnTmrPresent;
                            bookChargingGetResponse.reservationStopTiChrgnTmrPresent = data.m.reservationStopTiChrgnTmrPresent;
                            bookChargingGetResponse.priorityFullSwitchStsPresent = data.m.priorityFullSwitchStsPresent;

                            callback->onRemoteBookChrgnSetSynNotification_Use0x20(bookChargingGetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    }
    else if (OP_ID_ELECTRICALPOWER_SINGLE_RESERVATION_CHRGN_END == header->operation_id) {
        ALOGI("OP_ID_ELECTRICALPOWER_SINGLE_RESERVATION_CHRGN_END");
        switch (header->op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpSingleReservationChrgnEnd_Notification data;
                ASN1C_OpSingleReservationChrgnEnd_Notification OpSingleReservationChrgnEnd_Notification(decodeBuffer, data);
                if (OpSingleReservationChrgnEnd_Notification.Decode()) {
                    ALOGE("%s: OpSingleReservationChrgnEnd_Notification decode error", __func__);
                } else {
                    ALOGV("%s: OpSingleReservationChrgnEnd_Notification decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            ALOGD("%s: singleReservationChrgnEnd: %d", __func__, data.singleReservationChrgnEnd);
                            //callback->onRemoteBookChrgnSetSynNotification_Use0x20(bookChargingGetResponse);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("decode error");
                } else {
                    ALOGV("decode success");
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            //callback->onChargingResponseError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("electricpower_received_cb unkonw op_type");
                break;
        }
    }
}

void xcall_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("xcall recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<--------------xcall receive package info------------------>");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");

    if (OP_ID_XCALL_PREMIUM_AUDIO == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_PREMIUM_AUDIO Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_REQUEST: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1C_OpGeneric_Request OpGeneric_RequestPDU(decodeBuffer);
                if (OpGeneric_RequestPDU.Decode()) {
                    ALOGE("%s: OpGeneric_RequestPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_RequestPDU decode success", __func__);
                    mAudioStatusHandleId = header->senderHandleId;
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->requestPremiumAudio();
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onPremiumAudioError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_PREMIUM_AUDIO unkonw op_type", __func__);
                break;
        }
        ALOGI("%s: OP_ID_XCALL_PREMIUM_AUDIO End", __func__);
    } else if (OP_ID_XCALL_XCALL_STATUS == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_XCALL_STATUS Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpXCallStatus_Response data;
                ASN1C_OpXCallStatus_Response OpXCallStatus_ResponsePDU(decodeBuffer, data);
                if (OpXCallStatus_ResponsePDU.Decode()) {
                    ALOGE("%s: OpXCallStatus_ResponsePDU decode error", __func__);
                } else {
                    ALOGV("%s: OpXCallStatus_ResponsePDU decode success", __func__);
                    CallType callType;
                    CallStatus callStatus;
                    CallBackMode callbackMode;
                    switch (data.type) {
                        case XCallStatus_CallType::noCall: {
                            callType = CallType::NoCall;
                            break;
                        }
                        case XCallStatus_CallType::iCall: {
                            callType = CallType::ICall;
                            break;
                        }
                        case XCallStatus_CallType::bCall: {
                            callType = CallType::BCall;
                            break;
                        }
                        case XCallStatus_CallType::eCall: {
                            callType = CallType::ECall_SOS;
                            break;
                        }
                        default:
                            callType = CallType::NoCall;
                            ALOGE("%s: OpXCallStatus_ResponsePDU unkonw call type", __func__);
                            break;
                    }

                    switch (data.status) {
                        case ::CallStatus::callStart: {
                            callStatus = CallStatus::CallStart;
                            break;
                        }
                        case ::CallStatus::incomingCall: {
                            callStatus = CallStatus::IncomingCall;
                            break;
                        }
                        case ::CallStatus::callFailedReconnection: {
                            callStatus = CallStatus::CallFailedReconnection;
                            break;
                        }
                        case ::CallStatus::callFailed: {
                            callStatus = CallStatus::CallFailed;
                            break;
                        }
                        case ::CallStatus::callConnecting: {
                            callStatus = CallStatus::CallConnecting;
                            break;
                        }
                        case ::CallStatus::callConnected: {
                            callStatus = CallStatus::CallConnected;
                            break;
                        }
                        case ::CallStatus::callDataSending: {
                            callStatus = CallStatus::CallDataSending;
                            break;
                        }
                        case ::CallStatus::callEnded: {
                            callStatus = CallStatus::CallEnd;
                            break;
                        }
                        default:
                            callStatus = CallStatus::CallFailed;
                            ALOGE("%s: OpXCallStatus_ResponsePDU unkonw call status", __func__);
                            break;
                    }

                    if (0x00 == data.callBackMode) {
                        callbackMode = CallBackMode::Normal;
                    } else if (0x1 == data.callBackMode) {
                        callbackMode = CallBackMode::CallBack;
                    } else {
                        callbackMode = CallBackMode::Normal;
                    }
                    ALOGD("%s: XCALL_Status -> callType[noCall(0), iCall(1), bCall(2), eCall(3)]: %d",
                            __func__, callType);
                    ALOGD("%s: XCALL_Status -> callStatus[Start(0), incoming(1), FailedReconnection(2), Failed(3)]: %d",
                            __func__, callStatus);
                    ALOGD("%s: XCALL_Status -> callStatus[Connecting(4), Connected(5), DataSending(6), Ended(7)]: %d",
                            __func__, callStatus);
                    ALOGD("%s: XCALL_Status -> callbackMode[Normal(0), CallBack(1)]: %d",
                            __func__, callbackMode);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onXcallStatusResponse(callType, callStatus, callbackMode);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpXCallStatus_Notification data;
                ASN1C_OpXCallStatus_Notification OpXCallStatus_NotificationPDU(decodeBuffer, data);
                if (OpXCallStatus_NotificationPDU.Decode()) {
                    ALOGE("%s: OpXCallStatus_NotificationPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpXCallStatus_NotificationPDU decode success", __func__);
                    CallType callType;
                    CallStatus callStatus;
                    CallBackMode callbackMode;
                    switch (data.type) {
                        case XCallStatus_CallType::noCall: {
                            callType = CallType::NoCall;
                            break;
                        }
                        case XCallStatus_CallType::iCall: {
                            callType = CallType::ICall;
                            break;
                        }
                        case XCallStatus_CallType::bCall: {
                            callType = CallType::BCall;
                            break;
                        }
                        case XCallStatus_CallType::eCall: {
                            callType = CallType::ECall_SOS;
                            break;
                        }
                        default:
                            callType = CallType::NoCall;
                            ALOGE("%s: OpXCallStatus_NotificationPDU unkonw call type", __func__);
                            break;
                    }

                    switch (data.status) {
                        case ::CallStatus::callStart: {
                            callStatus = CallStatus::CallStart;
                            break;
                        }
                        case ::CallStatus::incomingCall: {
                            callStatus = CallStatus::IncomingCall;
                            break;
                        }
                        case ::CallStatus::callFailedReconnection: {
                            callStatus = CallStatus::CallFailedReconnection;
                            break;
                        }
                        case ::CallStatus::callFailed: {
                            callStatus = CallStatus::CallFailed;
                            break;
                        }
                        case ::CallStatus::callConnecting: {
                            callStatus = CallStatus::CallConnecting;
                            break;
                        }
                        case ::CallStatus::callConnected: {
                            callStatus = CallStatus::CallConnected;
                            break;
                        }
                        case ::CallStatus::callDataSending: {
                            callStatus = CallStatus::CallDataSending;
                            break;
                        }
                        case ::CallStatus::callEnded: {
                            callStatus = CallStatus::CallEnd;
                            break;
                        }
                        default:
                            callStatus = CallStatus::CallFailed;
                            ALOGE("%s: OpXCallStatus_NotificationPDU unkonw call status", __func__);
                            break;
                    }

                    if (0x00 == data.callBackMode) {
                        callbackMode = CallBackMode::Normal;
                    } else if (0x1 == data.callBackMode) {
                        callbackMode = CallBackMode::CallBack;
                    } else {
                        callbackMode = CallBackMode::Normal;
                    }
                    ALOGD("%s: XCALL_Status -> callType[noCall(0), iCall(1), bCall(2), eCall(3)]: %d",
                            __func__, callType);
                    ALOGD("%s: XCALL_Status -> callStatus[Start(0), incoming(1), FailedReconnection(2), Failed(3)]: %d",
                            __func__, callStatus);
                    ALOGD("%s: XCALL_Status -> callStatus[Connecting(4), Connected(5), DataSending(6), Ended(7)]: %d",
                            __func__, callStatus);
                    ALOGD("%s: XCALL_Status -> callbackMode[Normal(0), CallBack(1)]: %d",
                            __func__, callbackMode);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onXcallStatusNotification(callType, callStatus, callbackMode);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onXCallStatusError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_XCALL_STATUS unkonw op_type", __func__);
                break;
        }
    } else if (OP_ID_XCALL_MUTE_COMMAND == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_MUTE_COMMAND Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpMUTECommand_Notification data;
                ASN1C_OpMUTECommand_Notification OpMUTECommand_NotificationPDU(decodeBuffer, data);
                if (OpMUTECommand_NotificationPDU.Decode()) {
                    ALOGE("%s: OpMUTECommand_NotificationPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpMUTECommand_NotificationPDU decode success", __func__);
                    ECallMute eCallMuteStatus;
                    switch (data.ecallMute) {
                        case EcallMute::unmute: {
                            eCallMuteStatus = ECallMute::Mute;
                            break;
                        }
                        case EcallMute::mute: {
                            eCallMuteStatus = ECallMute::UnMute;
                            break;
                        }
                        default:
                            ALOGE("%s: OpMUTECommand_NotificationPDU unkonw eCallMuteStatus", __func__);
                            break;
                    }
                    ALOGD("%s: XCALL_MUTE -> data.ecallMute[unmute(0), mute(1)]: %d", __func__, data.ecallMute);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onMuteStatusNotification(eCallMuteStatus);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onMUTECommandError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_MUTE_COMMAND unkonw op_type", __func__);
                break;
        }
    } else if (OP_ID_XCALL_POIINFO_PUSH == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_POIINFO_PUSH Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpPOIInfoPush_Notification data;
                ASN1C_OpPOIInfoPush_Notification OpPOIInfoPush_NotificationPDU(decodeBuffer, data);
                if (OpPOIInfoPush_NotificationPDU.Decode()) {
                    ALOGE("%s: OpPOIInfoPush_NotificationPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_RequestPDU decode success", __func__);
                    ASN1T_PostAddress postAddress = data.postAddress;
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onPOIInfoNotification(
                                hidl_string((char*)data.poiname), data.longitude, data.latitude,
                                hidl_string((char*)postAddress.street),
                                hidl_string((char*)postAddress.houseNumber),
                                hidl_string((char*)postAddress.city),
                                hidl_string((char*)postAddress.region),
                                hidl_string((char*)postAddress.postcode),
                                hidl_string((char*)postAddress.country));
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onPOIInfoPushError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_POIINFO_PUSH unkonw op_type", __func__);
                break;
        }
    } else if (OP_ID_XCALL_CALLBACKSTS == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_CALLBACKSTS Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpCallBackSts_Response data;
                ASN1C_OpCallBackSts_Response OpCallBackSts_ResponsePDU(decodeBuffer, data);
                if (OpCallBackSts_ResponsePDU.Decode()) {
                    ALOGE("%s: OpCallBackSts_ResponsePDU decode error", __func__);
                } else {
                    ALOGV("%s: OpCallBackSts_ResponsePDU decode success", __func__);
                    int32_t remainTime;
                    remainTime = data.remainTime;
                    ALOGD("%s: XCALL_CALLBACKSTS -> remainTime: %d", __func__, remainTime);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onCallBackStatusResponse(remainTime);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_NOTIFICATION_CYC: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpCallBackSts_Response data;
                ASN1C_OpCallBackSts_Response OpCallBackSts_NotificationCyclicPDU(decodeBuffer, data);
                if (OpCallBackSts_NotificationCyclicPDU.Decode()) {
                    ALOGE("%s: OP_TYPE_NOTIFICATION_CYC decode error", __func__);
                } else {
                    ALOGV("%s: OP_TYPE_NOTIFICATION_CYC decode success", __func__);
                    int32_t remainTime;
                    remainTime = data.remainTime;
                    ALOGD("%s: XCALL_CALLBACKSTS -> remainTime: %d", __func__, remainTime);
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onCallBackStatusNotification(remainTime);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onCallBackStatusError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_CALLBACKSTS unkonw op_type", __func__);
                break;
        }
    } else if (OP_ID_XCALL_ETAINFO == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_ETAINFO Start", __func__);
        switch (packet->header.op_type) {
            case OP_TYPE_RESPONSE: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpETAInfo_Response data;
                ASN1C_OpETAInfo_Response ETAInfo_ResponsePDU(decodeBuffer, data);
                if (ETAInfo_ResponsePDU.Decode()) {
                    ALOGE("%s: ETAInfo_ResponsePDU decode error", __func__);
                } else {
                    ALOGV("%s: ETAInfo_ResponsePDU decode success", __func__);
                    int32_t hour = data.eTAInfo.hour;
                    int32_t minute = data.eTAInfo.minute;
                    int32_t second = data.eTAInfo.second;

                    ALOGD("%s: OP_ID_XCALL_ETAINFO -> hour: %d minute: %d second: %d", __func__, hour, minute, second);

                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onETAInfoResponse(hour, minute, second);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_NOTIFICATION: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpETAInfo_Response data;
                ASN1C_OpETAInfo_Response ETAInfo_ResponsePDU(decodeBuffer, data);
                if (ETAInfo_ResponsePDU.Decode()) {
                    ALOGE("%s: OP_TYPE_NOTIFICATION ETAInfo_ResponsePDU decode error", __func__);
                } else {
                    ALOGV("%s: OP_TYPE_NOTIFICATION ETAInfo_ResponsePDU decode success", __func__);
                    int32_t hour = data.eTAInfo.hour;
                    int32_t minute = data.eTAInfo.minute;
                    int32_t second = data.eTAInfo.second;

                    ALOGD("%s: OP_ID_XCALL_ETAINFO -> hour: %d minute: %d second: %d", __func__, hour, minute, second);

                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onETAInfoNotification(hour, minute, second);
                        }
                    }
                }
                break;
            }
            case OP_TYPE_ERROR: {
                ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
                ASN1T_OpGeneric_Error data;
                ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
                if (OpGeneric_ErrorPDU.Decode()) {
                    ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
                } else {
                    ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                    //通知上层tcam service
                    sp<Tcam> tcam = Tcam::getTcam();
                    if (tcam != nullptr) {
                        sp<ITcamCallback> callback = tcam->getCallback();
                        if (callback != nullptr) {
                            callback->onETAInfoError();
                        }
                    }
                }
                break;
            }
            default:
                ALOGE("%s: OP_ID_XCALL_ETAINFO unkonw op_type", __func__);
                break;
        }
    } else if (OP_ID_XCALL_IHUSTATUS_REPORT == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_IHUSTATUS_REPORT Start", __func__);
        if (OP_TYPE_ERROR == packet->header.op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
            } else {
                ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onIHUStatusReportError();
                    }
                }
            }
        }
    } else if (OP_ID_XCALL_XCALL_CONTROL == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_XCALL_CONTROL Start", __func__);
        if (OP_TYPE_ERROR == packet->header.op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
            } else {
                ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onXCallControlError();
                    }
                }
            }
        }
    } else if (OP_ID_XCALL_CALL_CENTER_PRE == header->operation_id) {
        ALOGI("%s: OP_ID_XCALL_CALL_CENTER_PRE Start", __func__);
        if (OP_TYPE_ERROR == packet->header.op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("%s: OpGeneric_ErrorPDU decode error", __func__);
            } else {
                ALOGV("%s: OpGeneric_ErrorPDU decode success", __func__);
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onCallcenterPreError();
                    }
                }
            }
        }
    }
}

void rvdc_received_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("rvdc recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<--------------------rvdc receive package info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_RVDC_LANGSETTINGS == header->operation_id) {
        ALOGV("OP_ID_RVDC_LANGSETTINGS");
        if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("OP_TYPE_ERROR decode error");
            } else {
                ALOGV("OP_TYPE_ERROR decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCLanguageStatusError();
                    }
                }
            }
        }
    } else if (OP_ID_RVDC_AUTHORIZATION_STATUS_REQUEST == header->operation_id) {
        ALOGV("OP_ID_RVDC_AUTHORIZATION_STATUS_REQUEST");
        if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("OP_TYPE_ERROR decode error");
            } else {
                ALOGV("OP_TYPE_ERROR decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCAuthorizationStatusError();
                    }
                }
            }
        } else if (OP_TYPE_RESPONSE == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpRVDCAuthorizationStatusRequest_Response data;
            ASN1C_OpRVDCAuthorizationStatusRequest_Response RVDCAuthorizationStatusRequest_ResponsePDU(
                decodeBuffer, data);
            if (RVDCAuthorizationStatusRequest_ResponsePDU.Decode()) {
                ALOGE("OP_TYPE_RESPONSE decode error");
            } else {
                ALOGV("OP_TYPE_RESPONSE decode success");
                Collectfunction collectFunction;
                Datacollection dataCollection;
                Remotediagnostics remoteDiagnostics;

                if (data.collectfunction) {
                    collectFunction = Collectfunction::enabled;
                } else {
                    collectFunction = Collectfunction::disable;
                }

                if (data.authorizationstatus.datacollection) {
                    dataCollection = Datacollection::enabled;
                } else {
                    dataCollection = Datacollection::disable;
                }

                if (data.authorizationstatus.remotediagnostics) {
                    remoteDiagnostics = Remotediagnostics::enabled;
                } else {
                    remoteDiagnostics = Remotediagnostics::disable;
                }

                ALOGW("collectFunction = %d , dataCollection = %d , remoteDiagnostics = %d", collectFunction, dataCollection, remoteDiagnostics);

                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCAuthorizationStatusResponse(collectFunction, dataCollection,
                                                                    remoteDiagnostics);
                    }
                }
            }
        }
    } else if (OP_ID_RVDC_AUTHORIZATION_STATUS_NOTIFICATION == header->operation_id) {
        ALOGV("OP_ID_RVDC_AUTHORIZATION_STATUS_NOTIFICATION");
        if (OP_TYPE_NOTIFICATION == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpRVDCAuthorizationStatusNotification_Notification data;
            ASN1C_OpRVDCAuthorizationStatusNotification_Notification
                RVDCAuthorizationStatusNotificationPDU(decodeBuffer, data);
            if (RVDCAuthorizationStatusNotificationPDU.Decode()) {
                ALOGE("OP_TYPE_NOTIFICATION decode error");
            } else {
                ALOGV("OP_TYPE_NOTIFICATION decode success");
                Collectfunction collectFunction;
                Datacollection dataCollection;
                Remotediagnostics remoteDiagnostics;

                if (data.collectfunction) {
                    collectFunction = Collectfunction::enabled;
                } else {
                    collectFunction = Collectfunction::disable;
                }

                if (data.authorizationstatus.datacollection) {
                    dataCollection = Datacollection::enabled;
                } else {
                    dataCollection = Datacollection::disable;
                }

                if (data.authorizationstatus.remotediagnostics) {
                    remoteDiagnostics = Remotediagnostics::enabled;
                } else {
                    remoteDiagnostics = Remotediagnostics::disable;
                }

                ALOGW("collectFunction = %d , dataCollection = %d , remoteDiagnostics = %d", collectFunction, dataCollection, remoteDiagnostics);

                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCAuthorizationStatusNotification(
                            collectFunction, dataCollection, remoteDiagnostics);
                    }
                }
            }
        }
    } else if (OP_ID_RVDC_AUTHORIZATION_STATUS_USER_UPDATE == header->operation_id) {
        ALOGV("OP_ID_RVDC_AUTHORIZATION_STATUS_USER_UPDATE");
        if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("OP_TYPE_ERROR decode error");
            } else {
                ALOGV("OP_TYPE_ERROR decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCAuthorizationStatusUserUpdateError();
                    }
                }
            }
        } else if (OP_TYPE_RESPONSE == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpRVDCAuthorizationStatusUserUpdate_Response data;
            ASN1C_OpRVDCAuthorizationStatusUserUpdate_Response
                RVDCAuthorizationStatusUserUpdate_ResponsePDU(decodeBuffer, data);
            if (RVDCAuthorizationStatusUserUpdate_ResponsePDU.Decode()) {
                ALOGE("OP_TYPE_RESPONSE decode error");
            } else {
                ALOGV("OP_TYPE_RESPONSE decode success");
                Collectfunction collectFunction;
                Datacollection dataCollection;
                Remotediagnostics remoteDiagnostics;

                if (data.collectfunction) {
                    collectFunction = Collectfunction::enabled;
                } else {
                    collectFunction = Collectfunction::disable;
                }

                if (data.authorizationstatus.datacollection) {
                    dataCollection = Datacollection::enabled;
                } else {
                    dataCollection = Datacollection::disable;
                }

                if (data.authorizationstatus.remotediagnostics) {
                    remoteDiagnostics = Remotediagnostics::enabled;
                } else {
                    remoteDiagnostics = Remotediagnostics::disable;
                }

                ALOGW("collectFunction = %d , dataCollection = %d , remoteDiagnostics = %d", collectFunction, dataCollection, remoteDiagnostics);

                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onRVDCAuthorizationStatusUserUpdateResponse(
                            collectFunction, dataCollection, remoteDiagnostics);
                    }
                }
            }
        }
    }
}

void privatelocking_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("private locking recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV(
        "<--------------------private locking receive package "
        "info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_PRIVATELOCKING_CNTR == header->operation_id) {
        ALOGV("PRIVATELOCKING_CNTR");
        if (OP_TYPE_SET_REQUEST == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpPrivateLockCntr_SetRequest data;
            ASN1C_OpPrivateLockCntr_SetRequest OpPrivateLockCntr_SetRequestPDU(decodeBuffer, data);
            if (OpPrivateLockCntr_SetRequestPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                mPrivateLockCTRHandleId = header->senderHandleId;
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    PrivateLockCtrlReq ret = PrivateLockCtrlReq::req_default;
                    if (callback != nullptr) {
                        if (::PrivateLockCtrlReq::default_ == data.privateLockCtrlReq) {
                            ret = PrivateLockCtrlReq::req_default;
                        } else if (::PrivateLockCtrlReq::unlock == data.privateLockCtrlReq) {
                            ret = PrivateLockCtrlReq::unlock;
                        }
                        callback->requestPrivateLock(ret);
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onPrivateLockError();
                    }
                }
            }
        }
    } else if (OP_ID_PRIVATELOCKING_PWD == header->operation_id) {
        ALOGV("PRIVATELOCKING_PWD");
        if (OP_TYPE_SET_REQUEST == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpPrivateLockPassword_SetRequest data;
            ASN1C_OpPrivateLockPassword_SetRequest OpPrivateLockPassword_SetRequestPDU(decodeBuffer,
                                                                                       data);
            if (OpPrivateLockPassword_SetRequestPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                mPrivateLockPasswordHandleId = header->senderHandleId;
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->requestPrivatePassword(
                            hidl_string((char*)data.privateLockPassword));
                    }
                }
            }
        }
    } else if (OP_TYPE_ERROR == header->op_type) {
        ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
        ASN1T_OpGeneric_Error data;
        ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
        if (OpGeneric_ErrorPDU.Decode()) {
            ALOGE("decode error");
        } else {
            ALOGV("decode success");
            //通知上层tcam service
            sp<Tcam> tcam = Tcam::getTcam();
            if (tcam != nullptr) {
                sp<ITcamCallback> callback = tcam->getCallback();
                if (callback != nullptr) {
                    callback->onPrivateLockPasswordError();
                }
            }
        }
    }
}

void vehiclevideo_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("vehicle video recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV(
        "<--------------------vehicle video receive package "
        "info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_PLAY_CHAT_VIDEO_LIVEVIEW == header->operation_id) {
        ALOGV("PLAY_CHAT_VIDEO_LIVEVIEW");
        if (OP_TYPE_SET_REQUEST == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpPlayChatVideoLiveviewReq_Request data;
            ASN1C_OpPlayChatVideoLiveviewReq_Request OpPlayChatVideoLiveviewReq_RequestPDU(decodeBuffer, data);
            if (OpPlayChatVideoLiveviewReq_RequestPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                mPlayChatVideoHandleId = header->senderHandleId;
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->requestPlayChatVideoLiveview(hidl_string((char*)data.serverUrl));
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onPlayChatVideoLiveviewError();
                    }
                }
            }
        }
    } else if (OP_ID_STOP_CHAT_VIDEO_LIVEVIEW == header->operation_id) {
        ALOGV("STOP_CHAT_VIDEO_LIVEVIEW");
        if (OP_TYPE_SET_REQUEST == header->op_type) {
            mStopChatVideoHandleId = header->senderHandleId;
            sp<Tcam> tcam = Tcam::getTcam();
            if (tcam != nullptr) {
                sp<ITcamCallback> callback = tcam->getCallback();
                if (callback != nullptr) {
                    callback->requestStopChatVideoLiveview();
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onStopChatVideoLiveviewError();
                    }
                }
            }
        }
    }
}

void sec_row_facial_recognition_receive_cb(ipcp_packet_t* packet, ipcp_peer_t peer) {
    ALOGI("sec row facial recognition recv_cb... ");
    ipcp_header_t* header = &packet->header;
    uint16_t len = header->length - ASN_HEADER_LENGTH_OFFSET;
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV(
        "<--------------------sec row facial recognition receive package "
        "info----------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("%s, received ipcp header : sid: %hu\n", __func__, header->service_id);
    ALOGV("%s, opid : %hu \n", __func__, header->operation_id);
    ALOGV("%s, optype : %hhu \n", __func__, header->op_type);
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("<-------------------------------------------------------------------->");
    ALOGV("\n");
    ALOGV("\n");
    ALOGV("\n");
    if (OP_ID_SEC_ROW_FACE_INFO_UPLOAD_FB == header->operation_id) {
        ALOGV("SEC_ROW_FACE_INFO_UPLOAD_FB");
        if (OP_TYPE_NOTIFICATION == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpSecRowFaceInfoUploadFb_Notification data;
            ASN1C_OpSecRowFaceInfoUploadFb_Notification OpSecRowFaceInfoUploadFb_NotificationPDU(decodeBuffer, data);
            if (OpSecRowFaceInfoUploadFb_NotificationPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        SecRowFaceInfoUploadSts secRowFaceInfoUploadSts = SecRowFaceInfoUploadSts::fail;
                        if (::SecRowFaceInfoUploadSts::success ==
                                    data.secRowFaceInfoUploadSts) {
                            secRowFaceInfoUploadSts = SecRowFaceInfoUploadSts::success;
                        } else if (::SecRowFaceInfoUploadSts::fail == data.secRowFaceInfoUploadSts) {
                            secRowFaceInfoUploadSts = SecRowFaceInfoUploadSts::fail;
                        }
                        callback->onSecRowFaceInfoUploadFb(secRowFaceInfoUploadSts, handleSecRowfaceInfoAcqGid(data.secRowfaceInfoAcqGid.numocts, data.secRowfaceInfoAcqGid.data));
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onSecRowFaceInfoUploadFbError();
                    }
                }
            }
        }
    } else if (OP_ID_SEC_ROW_FACE_RECOGNITION_REQ == header->operation_id) {
        ALOGV("SEC_ROW_FACE_RECOGNITION_REQ");
        if (OP_TYPE_NOTIFICATION == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpSecRowFaceRecognitionReq_Notification data;
            ASN1C_OpSecRowFaceRecognitionReq_Notification OpSecRowFaceRecognitionReq_NotificationPDU(decodeBuffer, data);
            if (OpSecRowFaceRecognitionReq_NotificationPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->NotifyOpSecRowFaceRecognitionReq(
                            handleSecRowFaceInfoRespGid(data.u.secRowFaceInfo->secRowFaceInfoRespGid.numocts, data.u.secRowFaceInfo->secRowFaceInfoRespGid.data), 
                            handleSecRowFaceInfoResp(data.u.secRowFaceInfo->secRowFaceInfoResp.numocts, data.u.secRowFaceInfo->secRowFaceInfoResp.data));
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onSecRowFaceRecognitionReqError();
                    }
                }
            }
        }
    } else if (OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_RE == header->operation_id) {
        ALOGV("SEC_ROW_FACE_SGN_IN_PICTURE_RE");
        if (OP_TYPE_RESPONSE == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_Response data;
            ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_Response ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_ResponsePDU(decodeBuffer, data);
            if (ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_ResponsePDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        SecondRowfaceInfosynSts secondRowfaceInfosynSts = SecondRowfaceInfosynSts::fail;
                        if (::SecondRowfaceInfosynSts::success == data.secondRowfaceInfosynSts) {
                            secondRowfaceInfosynSts = SecondRowfaceInfosynSts::success;
                        } else if (::SecondRowfaceInfosynSts::fail == data.secondRowfaceInfosynSts) {
                            secondRowfaceInfosynSts = SecondRowfaceInfosynSts::fail;
                        }
                        callback->responseSecRowFaceSgnInPictureRe(secondRowfaceInfosynSts);
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onSecRowFaceSgnInPictureReError();
                    }
                }
            }
        }
    } else if (OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_CENTER == header->operation_id) {
        ALOGV("SEC_ROW_FACE_SGN_IN_PICTURE_CENTER");
        if (OP_TYPE_REQUEST == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpSecRowFaceSgnInPictureCenter_Request data;
            ASN1C_OpSecRowFaceSgnInPictureCenter_Request ASN1C_OpSecRowFaceSgnInPictureCenter_RequestPDU(decodeBuffer, data);
            if (ASN1C_OpSecRowFaceSgnInPictureCenter_RequestPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->requestSecRowFaceSgnInPictureCenter(handleFirstRowfaceInfosynImg(data.firstRowfaceInfosynImg.numocts, data.firstRowfaceInfosynImg.data));
                    }
                }
            }
        } else if (OP_TYPE_ERROR == header->op_type) {
            ASN1PERDecodeBuffer decodeBuffer((OSOCTET*)packet->payload, len, false);
            ASN1T_OpGeneric_Error data;
            ASN1C_OpGeneric_Error OpGeneric_ErrorPDU(decodeBuffer, data);
            if (OpGeneric_ErrorPDU.Decode()) {
                ALOGE("decode error");
            } else {
                ALOGV("decode success");
                //通知上层tcam service
                sp<Tcam> tcam = Tcam::getTcam();
                if (tcam != nullptr) {
                    sp<ITcamCallback> callback = tcam->getCallback();
                    if (callback != nullptr) {
                        callback->onSecRowFaceSgnInPictureCenterError();
                    }
                }
            }
        }
    }
}

void setupElectricpower() {
    ALOGV("tcam electricpower init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_electricpower_side(&client_config);
    ALOGV("tcam electricpower setup ipcp");
    client_error_code =
        ipcp_setup_with_opids(client_config, &electricpower_callbacks, Charging_OperationIDs, 13);
    if (client_error_code != 0) {
        ALOGE("tcam client side electricpower setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side electricpower setup success");
    }
}

void setupXCall() {
    ALOGV("tcam xcall init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_xcall_side(&client_config);
    ALOGV("tcam xcall setup ipcp");
    client_error_code =
        ipcp_setup_with_opids(client_config, &xcall_callbacks, XCALL_OperationIDs, 9);
    if (client_error_code != 0) {
        ALOGE("tcam client side xcall setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side xcall setup success");
    }
}

void setupRvdc() {
    ALOGV("tcam rvdc init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_rvdc_side(&client_config);
    ALOGV("tcam rvdc setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &rvdc_callbacks, RVDC_OperationIDs, 4);
    if (client_error_code != 0) {
        ALOGE("tcam client side rvdc setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side rvdc setup success");
    }
}

void setupPrivateLocking() {
    ALOGV("tcam privatelocking init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_privatelocking(&client_config);
    ALOGV("tcam privatelocking setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &privatelocking_callback,
                                              PrivateLocking_OperationIDs, 2);
    if (client_error_code != 0) {
        ALOGE("tcam client side privatelocking setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side privatelocking setup success");
    }
}

void setupGidProf() {
    ALOGV("tcam gidprof init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_gidprof(&client_config);
    ALOGV("tcam gidprof setup ipcp");
    client_error_code =
        ipcp_setup_with_opids(client_config, &lightshow_callback, GidProf_OperationIDs, 1);
    if (client_error_code != 0) {
        ALOGE("tcam client side gidprof setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side gidprof setup success");
    }
}

void setupBook() {
    ALOGV("tcam book init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_book(&client_config);
    ALOGV("tcam book setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &book_callback, Book_OperationIDs, 3);
    if (client_error_code != 0) {
        ALOGE("tcam client side book setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side book setup success");
    }
}

void setupLightShow() {
    ALOGV("tcam lightshow init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_lightshow(&client_config);
    ALOGV("tcam lightshow setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &lightshow_callback,
                                              ExteriorLightShow_OperationIDs, 4);
    if (client_error_code != 0) {
        ALOGE("tcam client side lightshow setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side lightshow setup success");
    }
}

void setupVehicleVideo() {
    ALOGV("tcam vehiclevideo init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_vehiclevideo(&client_config);
    ALOGV("tcam vehiclevideo setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &vehiclevideo_callback,
                                              VehicleVideo_OperationIDs, 4);
    if (client_error_code != 0) {
        ALOGE("tcam client side vehiclevideo setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side vehiclevideo setup success");
    }
}

void setupSecRowFacialRecognition() {
    ALOGV("tcam SecRowFacialRecognition init config");
    ipcp_transport_conf_t client_config;
    ipcp_stack_err_t client_error_code;
    memset(&client_config, 0, sizeof(client_config));
    memset(&client_error_code, 0, sizeof(client_error_code));
    init_sec_row_facial_recognition(&client_config);
    ALOGV("tcam SecRowFacialRecognition setup ipcp");
    client_error_code = ipcp_setup_with_opids(client_config, &sec_row_facial_recognition_callback,
                                              SecRowFacialRecognition_OperationIDs, 6);
    if (client_error_code != 0) {
        ALOGE("tcam client side SecRowFacialRecognition setup error: %d", client_error_code);
    } else {
        ALOGV("tcam client side SecRowFacialRecognition setup success");
    }
}

Tcam::Tcam()
    : mIplmCallbackDeathRecipient(new DeathRecipient(this)),
      mTcamServiceCallbackDeathRecipient(new TcamServiceCallBackDeathRecipient(this)),
      mVehicleDeathRecipient(new VehicleDeathRecipient(this)) {
    sTcam = this;
    ALOGI("%s, sTcam is %p", __func__, sTcam);
}

Tcam::~Tcam() {
    ALOGI("%s", __func__);
    if (mIPLM != nullptr) {
        mIPLM->unlinkToDeath(mIplmCallbackDeathRecipient);
    }
    if (mCallback != nullptr) {
        mCallback->unlinkToDeath(mTcamServiceCallbackDeathRecipient);
        mCallback = nullptr;
    }
    if (mIVehicle != nullptr) {
        mIVehicle->unlinkToDeath(mVehicleDeathRecipient);
    }

    if (sTcam != nullptr) {
        sTcam = nullptr;
    }
}

sp<Tcam> Tcam::getTcam() {
    ALOGI("%s, sTcam is %p", __func__, sTcam);
    if (sTcam == nullptr) {
        sTcam = new Tcam();
    }
    return sTcam;
}

void Tcam::onFirstRef() {
    ALOGI("%s", __func__);
    setupIPCP();
}

int Tcam::init_vehicle_server() {
    ALOGI("%s: Connecting to Vehicle HAL", __func__);
    if (mIVehicle != nullptr) {
        ALOGD("%s: Vehicle Interface already initialized", __func__);
        return 0;
    }
    mIVehicle = IVehicle::tryGetService();
    if (mIVehicle == nullptr) {
        ALOGE("%s: tryGetService failed", __func__);
        return -1;
    } else {
        mIVehicle->linkToDeath(mVehicleDeathRecipient, 0);
        ALOGD("%s: tryGetService success!", __func__);
    }
    return 0;
}

void Tcam::setupIPLM() {
    ALOGI("setupIPLM starting......");
    mIPLM = IIplm::getService();
    if (mIPLM != nullptr) {
        mIPLM->linkToDeath(mIplmCallbackDeathRecipient, 0);

        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::TransferElectricalPower,
                                          ServiceStatus::OnLine)) {
            ALOGV("IPLM set TRANSFER_ELECTRICAL_POWER SUCCESS");
        } else {
            ALOGE("IPLM set TRANSFER_ELECTRICAL_POWER failed");
        }
        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::XCall, ServiceStatus::OnLine)) {
            ALOGV("IPLM set EMERGENCY_ASSIST SUCCESS");
        } else {
            ALOGE("IPLM set EMERGENCY_ASSIST failed");
        }
        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::RVDC, ServiceStatus::OnLine)) {
            ALOGV("IPLM set RVDC SUCCESS");
        } else {
            ALOGE("IPLM set RVDC failed");
        }
        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::PrivateLockingInterStorage,
                                          ServiceStatus::OnLine)) {
            ALOGV("IPLM set POSITIONING SUCCESS");
        } else {
            ALOGE("IPLM set POSITIONING failed");
        }

        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::ExteriorLightShow,
                                          ServiceStatus::OnLine)) {
            ALOGV("IPLM set lightshow SUCCESS");
        } else {
            ALOGE("IPLM set lightshow failed");
        }

        // todo IPLM增加对应ServiceID
        // if (iplm::V1_0::StatusCode::SUCCESS ==
        //     mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::BookTravel,
        //                                   ServiceStatus::OnLine)) {
        //     ALOGV("GidProf set lightshow SUCCESS");
        // } else {
        //     ALOGE("GidProf set lightshow failed");
        // }

        // if (iplm::V1_0::StatusCode::SUCCESS ==
        //     mIPLM->setPrecfgServiceStatus(IPLM_Preconfigured_Service::GidProf,
        //                                   ServiceStatus::OnLine)) {
        //     ALOGV("Book set lightshow SUCCESS");
        // } else {
        //     ALOGE("Book set lightshow failed");
        // }

    } else {
        ALOGE("%s, can not get IPLM service", __func__);
    }
}

Return<StatusCode> Tcam::notifyPremiumAudioStatus(GenericStatus micStatus,
                                                  GenericStatus speakerStatus) {
    ALOGI("%s", __func__);
    auto task = [micStatus, speakerStatus]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpPremiumAudio_Response data;
        switch (micStatus) {
            case GenericStatus::unknown: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::unknown;
                break;
            }
            case GenericStatus::ok: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::ok;
                break;
            }
            case GenericStatus::notOk: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::notOk;
                break;
            }
            default:
                ALOGE("micStatus error");
                break;
        }

        switch (speakerStatus) {
            case GenericStatus::unknown: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::unknown;
                break;
            }
            case GenericStatus::ok: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::ok;
                break;
            }
            case GenericStatus::notOk: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::notOk;
                break;
            }
            default:
                ALOGE("speakerStatus error");
                break;
        }
        ASN1C_OpPremiumAudio_Response OpPremiumAudio_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpPremiumAudio_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpPremiumAudio encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_PREMIUM_AUDIO, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpPremiumAudio encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responsePremiumAudioStatus(GenericStatus micStatus,
                                                    GenericStatus speakerStatus) {
    ALOGI("%s", __func__);
    auto task = [micStatus, speakerStatus]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpPremiumAudio_Response data;
        switch (micStatus) {
            case GenericStatus::unknown: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::unknown;
                break;
            }
            case GenericStatus::ok: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::ok;
                break;
            }
            case GenericStatus::notOk: {
                data.premiumAudioStatus.micStatus = GenericOkStatus::notOk;
                break;
            }
            default:
                data.premiumAudioStatus.micStatus = GenericOkStatus::unknown;
                ALOGE("micStatus error");
                break;
        }

        switch (speakerStatus) {
            case GenericStatus::unknown: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::unknown;
                break;
            }
            case GenericStatus::ok: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::ok;
                break;
            }
            case GenericStatus::notOk: {
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::notOk;
                break;
            }
            default:
                data.premiumAudioStatus.speakerStatus = GenericOkStatus::unknown;
                ALOGE("micStatus error");
                break;
        }
        ALOGD("%s: PremiumAudioStatus -> premiumAudioStatus.micStatus[unknown(0), ok(1), notOk(2)]: %d",
                __func__, data.premiumAudioStatus.micStatus);
        ALOGD("%s: PremiumAudioStatus -> premiumAudioStatus.speakerStatus[unknown(0), ok(1), notOk(2)]: %d",
                __func__, data.premiumAudioStatus.speakerStatus);
        ASN1C_OpPremiumAudio_Response OpPremiumAudio_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpPremiumAudio_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpPremiumAudio_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_response(SERVICE_ID_XCALL, OP_ID_XCALL_PREMIUM_AUDIO,
                                    mAudioStatusHandleId, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpPremiumAudio_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responsePrivateLockPassword(PrivateLockPasswordResp privateLockPasswordResp) {
    auto task = [privateLockPasswordResp, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpPrivateLockPassword_Response data;
        if (PrivateLockPasswordResp::fail == privateLockPasswordResp) {
            data.privateLockPasswordResp = ::PrivateLockPasswordResp::fail;
        } else if (PrivateLockPasswordResp::success == privateLockPasswordResp) {
            data.privateLockPasswordResp = ::PrivateLockPasswordResp::success;
        }
        ASN1C_OpPrivateLockPassword_Response OpPrivateLockPassword_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpPrivateLockPassword_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setPrivateLockResourceGroup();
            ALOGV("ASN1C_OpPrivateLockPassword_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet = build_ipcp_response(
                SERVICE_ID_PRIVATELOCKING, OP_ID_PRIVATELOCKING_PWD, mPrivateLockPasswordHandleId,
                IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_privatelocking_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
            ALOGV("OpPrivateLockPassword_Response encode success");
        } else {
            ALOGE("OpPrivateLockPassword_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);

    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responsePrivateLockCtrlResp(PrivateLockCtrlResp privateLockCtrlResp) {
    ALOGI("%s", __func__);
    auto task = [privateLockCtrlResp, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpPrivateLockCntr_Response data;
        if (PrivateLockCtrlResp::fail == privateLockCtrlResp) {
            data.privateLockCtrlResp = ::PrivateLockCtrlResp::fail;
        } else if (PrivateLockCtrlResp::success == privateLockCtrlResp) {
            data.privateLockCtrlResp = ::PrivateLockCtrlResp::success;
        }
        ASN1C_OpPrivateLockCntr_Response OpPrivateLockCntr_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpPrivateLockCntr_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setPrivateLockResourceGroup();
            ALOGV("OpPrivateLockCntr_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();

            ipcp_packet_t* packet = build_ipcp_response(
                SERVICE_ID_PRIVATELOCKING, OP_ID_PRIVATELOCKING_CNTR, mPrivateLockCTRHandleId,
                IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_privatelocking_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpPrivateLockCntr_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyIHUStatusReport(IHUStatusCommand status) {
    ALOGI("%s", __func__);
    auto task = [status]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpIHUStatusReport_Notification data;
        if (IHUStatusCommand::ErrorRestart == status) {
            data.command = IHUCommand::abnormalandreset;
        } else if (IHUStatusCommand::ShutDown == status) {
            data.command = IHUCommand::shutdown;
        } else if (IHUStatusCommand::HUStart == status) {
            data.command = IHUCommand::normalboot;
        }

        ASN1C_OpIHUStatusReport_Notification OpIHUStatusReport_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpIHUStatusReport_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpIHUStatusReport_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_IHUSTATUS_REPORT,
                                  OP_TYPE_NOTIFICATION, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpIHUStatusReport_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyXCallControl(HangupCall hangupCall, CallType callType) {
    ALOGI("%s", __func__);
    auto task = [hangupCall, callType, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpXCallControl_Notification data;
        if (HangupCall::HangupCurrentCall == hangupCall) {
            data.hangupCall = 0x0;
        } else if (HangupCall::RingXcall == hangupCall) {
            data.hangupCall = 0x1;
        }
        switch (callType) {
            case CallType::NoCall: {
                data.callType = ::CallType::noCall;
                break;
            }
            case CallType::ICall: {
                data.callType = ::CallType::iCall;
                break;
            }
            case CallType::BCall: {
                data.callType = ::CallType::bCall;
                break;
            }
            case CallType::ECall_SOS: {
                data.callType = ::CallType::eCall;
                break;
            }
            default:
                ALOGE("callType error");
                break;
        }

        ALOGD("%s: XCallControl -> hangupCall[Hangup(0), Dialing Call(1)]: %d", __func__, data.hangupCall);
        ALOGD("%s: XCallControl -> callType[noCall(0), iCall(1), bCall(2), eCall(3)]: %d", __func__, data.callType);
        if (data.callType == ::CallType::eCall || data.callType == ::CallType::bCall) {
            if (data.hangupCall) {
                if (mIVehicle == nullptr) {
                    init_vehicle_server();
                }
                setECallResourceGroup();
            }
        }

        ASN1C_OpXCallControl_Notification OpXCallControl_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpXCallControl_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpXCallControl_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_XCALL_CONTROL, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpXCallControl_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyCallcenterPre(CallCenterPreference callCenterPreference) {
    ALOGI("%s", __func__);
    auto task = [callCenterPreference]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpCallcenterPre_Notification data;
        switch (callCenterPreference) {
            case CallCenterPreference::PSAP: {
                data.callCenterPreference = ::CallCenterPreference::pSAP;
                break;
            }
            case CallCenterPreference::TPSP: {
                data.callCenterPreference = ::CallCenterPreference::tPSP;
                break;
            }
            default:
                ALOGE("callCenterPreference error");
                break;
        }

        ALOGD("%s: CallcenterPre -> callCenterPreference[pSAP(0), tPSP(1)]: %d", __func__, data.callCenterPreference);
        ASN1C_OpCallcenterPre_Notification OpCallcenterPre_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpCallcenterPre_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpCallcenterPre_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_CALL_CENTER_PRE, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpCallcenterPre_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyGIDProfIDLnk(const hidl_string& gid, ProFileID profId) {
    ALOGI("%s", __func__);
    auto task = [gid, profId, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_OpGIDProfIDLnk_Notification data;
        int profid = static_cast<int>(profId);
        data.profID = ProfID::Root(profid);
        data.gID = gid.c_str();
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setGIDProfIDLnkResourceGroup();
        ASN1C_OpGIDProfIDLnk_Notification OpGIDProfIDLnk_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpGIDProfIDLnk_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGIDProfIDLnk_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_GID_PROF, OP_ID_GIDPROFIDLNK, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_gidprof_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGIDProfIDLnk_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyLocalChrgnInfo(const LocalBookChrgnInfo& localBookChrgnInfo) {
    ALOGI("%s", __func__);
    lock_guard<mutex> lk(mMut);

    auto task = [localBookChrgnInfo, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpLocalBookChrgn_Notification data;
        LocalBookChrgnStatus status = localBookChrgnInfo.localBookChrgnStatus;
        DateTime start = localBookChrgnInfo.startTime;
        DateTime end = localBookChrgnInfo.stopTime;
        if (LocalBookChrgnStatus::OFF == status) {
            data.localBookChrgnTmrActvd = 0x0;
        } else if (LocalBookChrgnStatus::On == status) {
            data.localBookChrgnTmrActvd = 0x1;
        }
        data.m.localBookStrtTiChrgnTmrPresent = 1;
        data.m.localBookStopTiChrgnTmrPresent = 1;
        setTimeProperty(start, end, data.localBookChrgnTmrActvd);
        Utils::DateTime2Asn(start, data.localBookStrtTiChrgnTmr);
        Utils::DateTime2Asn(end, data.localBookStopTiChrgnTmr);

        ASN1C_OpLocalBookChrgn_Notification OpLocalBookChrgn_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpLocalBookChrgn_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setChargingResourceGroup();
            ALOGV("OpLocalBookChrgn_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_LOCALBOOKCHRGN,
                                  OP_TYPE_NOTIFICATION, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpLocalBookChrgn_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };

    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyLanguageStatus(LanguageType LanguageType) {
    ALOGI("%s", __func__);
    lock_guard<mutex> lk(mMut);
    auto task = [LanguageType, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpRVDCLanguageSettings_Notification data;
        int language = static_cast<int>(LanguageType);
        //转换方法待验证
        data.languagesetting = LanguageSetting::Root(language);
        ASN1C_OpRVDCLanguageSettings_Notification RVDCLanguageSetting_NotificationPDU(encodeBuffer,
                                                                                      data);
        if (ENCODE_SUCCESS == (stat = RVDCLanguageSetting_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("RVDCLanguageSetting_Notification encode success");
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setRvdcResourceGroup();
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_RVDC, OP_ID_RVDC_LANGSETTINGS, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_rvdc_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("RVDCLanguageSetting_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };

    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestXCallStatus() {
    ALOGI("%s", __func__);

    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_XCALL_STATUS, OP_TYPE_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestCallbackRemainTime() {
    ALOGI("%s", __func__);
    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_CALLBACKSTS, OP_TYPE_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestETAInfo() {
    ALOGI("%s", __func__);
    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_XCALL, OP_ID_XCALL_ETAINFO, OP_TYPE_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_xcall_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestExternalTcamIp() {
    ALOGI("%s", __func__);
    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_LIGHT_SHOW, OP_ID_REQUEST_EXTERNAL_TCAM_IP,
                                  OP_TYPE_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_lightshow_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyLightShowModeCyclic(LightShowMode lightShowMode) {
    auto task = [lightShowMode]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpLightShowMode_NotificationCyclic data;
        if (LightShowMode::singleMode == lightShowMode) {
            data.lightShowMode = LightShow_Mode::singleMode;
        } else if (LightShowMode::multipleMode == lightShowMode) {
            data.lightShowMode = LightShow_Mode::multipleMode;
        } else {
            ALOGE("lightShowMode unkonw");
        }

        ASN1C_OpLightShowMode_NotificationCyclic OpLightShowMode_NotificationCyclic(encodeBuffer,
                                                                                    data);
        if (ENCODE_SUCCESS == (stat = OpLightShowMode_NotificationCyclic.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpLightShowMode_NotificationCyclic encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_LIGHT_SHOW, OP_ID_LIGHT_SHOW_MODE,
                                  OP_TYPE_NOTIFICATION_CYC, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_lightshow_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpLightShowMode_NotificationCyclic encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::subscribe(const ::android::sp<ITcamCallback>& callback) {
    ALOGI("%s", __func__);
    lock_guard<mutex> lk(mMut);
    StatusCode ret = StatusCode::FAILED;
    if (mCallback == nullptr) {
        mCallback = callback;
        mCallback->linkToDeath(mTcamServiceCallbackDeathRecipient, 0);
        ret = StatusCode::SUCCESS;
        RemoteBookChrgnInfo info;
        if (mCallback != nullptr && getChargingStatus(info)) {
            mCallback->onRemoteBookChrgnInfoNotification(info);
        }

    } else {
        ALOGE("subscribe failed! do not unsubscribe!");
    }
    return ret;
}

Return<StatusCode> Tcam::unsubscribe(const ::android::sp<ITcamCallback>& callback) {
    ALOGI("%s", __func__);
    lock_guard<mutex> lk(mMut);
    StatusCode ret = StatusCode::FAILED;
    if (mCallback == callback) {
        ALOGI("%s, callback is subscribed,will unsubscribe", __func__);
    }
    if (mCallback != nullptr) {
        mCallback->unlinkToDeath(mTcamServiceCallbackDeathRecipient);
        mCallback = nullptr;
        ret = StatusCode::SUCCESS;
    } else {
        ALOGE("already unsubscribe!");
    }
    return ret;
}

Return<StatusCode> Tcam::requestRVDCAuthorizationStatus() {
    ALOGI("%s", __func__);
    auto task = [this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setRvdcResourceGroup();
            ALOGV("requestRVDCAuthorizationStatus OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet = build_ipcp_packet(
                SERVICE_ID_RVDC, OP_ID_RVDC_AUTHORIZATION_STATUS_REQUEST,
                OP_TYPE_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_rvdc_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE(
                "requestRVDCAuthorizationStatus OpGeneric_RequestPDU encode "
                "failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::setRequestRVDCAuthorizationStatusUserUpdate(
    Collectfunction collectFunction, Datacollection dataCollection,
    Remotediagnostics remoteDiagnostics) {
    ALOGI("%s", __func__);
    auto task = [collectFunction, dataCollection, remoteDiagnostics, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpRVDCAuthorizationStatusUserUpdate_SetRequest data;
        switch (collectFunction) {
            case Collectfunction::disable: {
                data.collectfunction = false;
                break;
            }
            case Collectfunction::enabled: {
                data.collectfunction = true;
                break;
            }
            default:
                ALOGE("collectFunction unkonw");
                break;
        }

        switch (dataCollection) {
            case Datacollection::disable: {
                data.authorizationstatus.datacollection = false;
                break;
            }
            case Datacollection::enabled: {
                data.authorizationstatus.datacollection = true;
                break;
            }
            default:
                ALOGE("dataCollection unkonw");
                break;
        }

        switch (remoteDiagnostics) {
            case Remotediagnostics::disable: {
                data.authorizationstatus.remotediagnostics = false;
                break;
            }
            case Remotediagnostics::enabled: {
                data.authorizationstatus.remotediagnostics = true;
                break;
            }
            default:
                ALOGE("remoteDiagnostics unkonw");
                break;
        }
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setRvdcResourceGroup();
        ASN1C_OpRVDCAuthorizationStatusUserUpdate_SetRequest
            OpRVDCAuthorizationStatusUserUpdate_SetRequestPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpRVDCAuthorizationStatusUserUpdate_SetRequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpRVDCAuthorizationStatusUserUpdate_SetRequest encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet = build_ipcp_packet(
                SERVICE_ID_RVDC, OP_ID_RVDC_AUTHORIZATION_STATUS_USER_UPDATE,
                OP_TYPE_SET_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_rvdc_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGW("collectFunction = %d , dataCollection = %d , remoteDiagnostics = %d", collectFunction, dataCollection, remoteDiagnostics);
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpRVDCAuthorizationStatusUserUpdate_SetRequest encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

sp<ITcamCallback> Tcam::getCallback() {
    if (mCallback != nullptr) {
        return mCallback;
    } else {
        return nullptr;
    }
}

void Tcam::handleHidlDeath() {
    ALOGD("%s", __func__);
    setupIPLM();
    // todo 暂时注释，等DTC功能实现后进行确认
    // setupDtcnl();
}

void Tcam::handleTcamServiceCallbackDeath() {
    ALOGD("%s", __func__);
    mCallback = nullptr;
}

void Tcam::handleVehicleHidlDeath() {
    ALOGD("%s", __func__);
    mIVehicle = nullptr;
    sleep(2);
    init_vehicle_server();
}

void Tcam::setupIPCP() {
    if (Tcam::mIpcpThread.joinable()) {
        ALOGI("setupIpcp start call mIpcpThread.join()");
        Tcam::mIpcpThread.join();
    }
    Tcam::mIpcpThread = std::thread([this]() {
        ALOGV("tcam rvdc init config");
        ipcp_transport_conf_t client_config;
        ipcp_stack_err_t client_error_code;
        memset(&client_config, 0, sizeof(client_config));
        memset(&client_error_code, 0, sizeof(client_error_code));
        init_rvdc_side(&client_config);

        while (true) {
            ALOGV("tcam rvdc setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &rvdc_callbacks, RVDC_OperationIDs, 4);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side rvdc setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));
            } else {
                ALOGV("tcam client side rvdc setup success");
                break;
            }
        }
        init_privatelocking(&client_config);
        while (true) {
            ALOGV("tcam privatelocking setup ipcp");
            client_error_code = ipcp_setup_with_opids(client_config, &privatelocking_callback,
                                                      PrivateLocking_OperationIDs, 2);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side privatelocking setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));
            } else {
                ALOGV("tcam client side privatelocking setup success");
                break;
            }
        }
        init_xcall_side(&client_config);
        while (true) {
            ALOGV("tcam xcall setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &xcall_callbacks, XCALL_OperationIDs, 9);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side xcall setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));
            } else {
                ALOGV("tcam client side xcall setup success");
                break;
            }
        }
        init_electricpower_side(&client_config);
        while (true) {
            ALOGV("tcam electricpower setup ipcp");
            client_error_code = ipcp_setup_with_opids(client_config, &electricpower_callbacks,
                                                      Charging_OperationIDs, 13);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side electricpower setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side electricpower setup success");
                break;
            }
        }
        init_lightshow(&client_config);
        while (true) {
            ALOGV("tcam lightshow setup ipcp");
            client_error_code = ipcp_setup_with_opids(client_config, &lightshow_callback,
                                                      ExteriorLightShow_OperationIDs, 4);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side lightshow setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side lightshow setup success");
                break;
            }
        }

        init_gidprof(&client_config);
        while (true) {
            ALOGV("tcam gidprof setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &gidprof_callback, GidProf_OperationIDs, 1);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side gidprof setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side gidprof setup success");
                break;
            }
        }

        init_book(&client_config);
        while (true) {
            ALOGV("tcam book setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &book_callback, Book_OperationIDs, 3);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side book setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side book setup success");
                break;
            }
        }

        init_vehiclevideo(&client_config);
        while (true) {
            ALOGV("tcam vehicle video setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &vehiclevideo_callback, VehicleVideo_OperationIDs, 4);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side vehicle video setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side vehicle video setup success");
                break;
            }
        }

        init_sec_row_facial_recognition(&client_config);
        while (true) {
            ALOGV("tcam sec row facial recognition setup ipcp");
            client_error_code =
                ipcp_setup_with_opids(client_config, &sec_row_facial_recognition_callback, SecRowFacialRecognition_OperationIDs, 6);
            if (client_error_code != 0) {
                //ipcp_cleanup();
                ALOGE("tcam client side sec row facial recognition setup error: %d", client_error_code);
                std::this_thread::sleep_for(std::chrono::milliseconds(2000));

            } else {
                ALOGV("tcam client side sec row facial recognition setup success");
                break;
            }
        }

        setupIPLM();
        // todo 暂时注释，等DTC功能实现后进行确认
        // setupDtcnl();
    });
    Tcam::mIpcpThread.detach();
}

void Tcam::setupDtcnl() {
    ALOGI("%s", __func__);
    //    mDtcnl = IDtcnl::getService();
    //    if (mDtcnl != nullptr) {
    //        ALOGV("IDtcnl getService success");
    //    } else {
    //       ALOGE("IDtcnl getService mDtcnl is nullptr");
    //    }
}

void Tcam::reportDtc() {
    ALOGI("%s", __func__);
    //    if (mDtcnl != nullptr) {
    //      if (dtcnl::V1_0::StatusCode::SUCCESS == mDtcnl->reportDtc(DTC_CODE,
    //      DTC_FLAG_STATE)) {
    //            ALOGV("reportDtc SUCCESS");
    //        } else {
    //          ALOGE("reportDtc failed");
    //        }
    //    } else {
    //        ALOGE("%s: IDtcnl mDtcnl is nullptr", __func__);
    //    }
}

void Tcam::setResourceGroupWithPriority(IPLM_ResourceGroup_Index resourceGroup,
                                        IPLM_RG_PRIO priority) {
    ALOGV("IPLM set setResourceGroupWithPriority resourceGroup = %d, priority = %d", resourceGroup,
          priority);
    if (mIPLM != nullptr) {
        if (iplm::V1_0::StatusCode::SUCCESS ==
            mIPLM->RequestResourceGroupWithPriority(resourceGroup, priority)) {
            ALOGV("IPLM set setResourceGroupWithPriority SUCCESS");
        } else {
            ALOGE("IPLM set setResourceGroupWithPriority failed");
        }
    } else {
        ALOGE("mIPLM = nullptr");
    }
}

void Tcam::setBookTravelResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carconfig13PropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::carconfig13,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carconfig573PropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::carconfig573,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        mIVehicle->get(carconfig13PropValue,
                       [&carconfig13PropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carconfig13PropValue = v;
                       });
        mIVehicle->get(carconfig573PropValue,
                       [&carconfig573PropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carconfig573PropValue = v;
                       });
        int32_t carconfig13 = carconfig13PropValue.value.int32Values[0];
        int32_t carconfig573 = carconfig573PropValue.value.int32Values[0];
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy) &&
            ((0x3 == (int32_t)carconfig13) || (0x4 == (int32_t)carconfig13)) && (0x03 == carconfig573)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV(
            "book carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,12,13): %d, carconfig13(Allow: 3,4) "
            "%d, carconfig573(Allow: 3) %d",
            carMode, usgMode, carconfig13, carconfig573);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setECallResourceGroup() {
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_HIGH);
        }
        ALOGV("ECall carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,11,13): %d", carMode, usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setRvdcResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode == (int32_t)UsgModSts1::UsgModInActv ||
             usgMode == (int32_t)UsgModSts1::UsgModDrvg) &&
            (carMode == (int32_t)CarModSts1::CarModNorm)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("isRvdcOk carmode(Allow: 0): %d, usgmode(Allow: 1,13): %d", carMode, usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setPrivateLockResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("Private lock carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,11,13): %d", carMode,
              usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setChargingResourceGroup() {
    ALOGI("%s", __func__);
    if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)DirectTransmitProperty::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)DirectTransmitProperty::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("Charging carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,11,13): %d", carMode, usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }
}

void Tcam::setGIDProfIDLnkResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode == (int32_t)CarModSts1::CarModNorm)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("isGIDProfIDOk carmode(Allow: 0): %d, usgmode(Allow: 1,2,11,13): %d", carMode,
              usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setVehicleVideoResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("Vehicle Video carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,11,13): %d", carMode,
              usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setSecRowFacialRecognitionResourceGroup() {
    ALOGI("%s", __func__);
    /*if (mIVehicle != nullptr) {
        ::android::hardware::automotive::vehicle::V2_0::StatusCode status =
            ::android::hardware::automotive::vehicle::V2_0::StatusCode::TRY_AGAIN;
        VehiclePropValue usgModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1UsgModSts,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        VehiclePropValue carModePropValue = {
            .prop = (int32_t)VendorSignalPropertyRX::VehModMngtGlbSafe1CarModSts1,
            .areaId = 1,
            .status = VehiclePropertyStatus::AVAILABLE,
            .timestamp = 0,
        };
        mIVehicle->get(usgModePropValue,
                       [&usgModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           usgModePropValue = v;
                       });
        mIVehicle->get(carModePropValue,
                       [&carModePropValue, &status](
                           ::android::hardware::automotive::vehicle::V2_0::StatusCode s,
                           const VehiclePropValue& v) {
                           status = s;
                           carModePropValue = v;
                       });
        int32_t usgMode = usgModePropValue.value.int32Values[0];
        int32_t carMode = carModePropValue.value.int32Values[0];
        if ((usgMode != (int32_t)UsgModSts1::UsgModAbdnd) &&
            (carMode != (int32_t)CarModSts1::CarModTrnsp &&
             carMode != (int32_t)CarModSts1::CarModFcy)) {
            setResourceGroupWithPriority(IPLM_ResourceGroup_Index::RG_1, IPLM_RG_PRIO::PRIO_NORM);
        }
        ALOGV("Sec Row Facial Recognition carmode(Allow: 0,3,5): %d, usgmode(Allow: 1,2,11,13): %d", carMode,
              usgMode);
    } else {
        ALOGE("mIVehicle = nullptr");
    }*/
}

void Tcam::setTimeProperty(DateTime startTime, DateTime stopTime, int switchStatus) {
    ALOGI("%s", __func__);
    android::base::SetProperty(SWITCH_STATUS, std::to_string(switchStatus));
    std::string startValue =
        std::to_string(startTime.year) + "." + std::to_string(startTime.month) + "." +
        std::to_string(startTime.day) + "." + std::to_string(startTime.hour) + "." +
        std::to_string(startTime.minute) + "." + std::to_string(startTime.second) + ".";
    std::string stopValue = std::to_string(stopTime.year) + "." + std::to_string(stopTime.month) +
                            "." + std::to_string(stopTime.day) + "." +
                            std::to_string(stopTime.hour) + "." + std::to_string(stopTime.minute) +
                            "." + std::to_string(stopTime.second) + ".";

    android::base::SetProperty(START_TIME, startValue);
    android::base::SetProperty(STOP_TIME, stopValue);
    ALOGV("ChrgnInfo startTime [%s]", android::base::GetProperty(START_TIME, "").c_str());
    ALOGV("ChrgnInfo stopTime [%s]", android::base::GetProperty(STOP_TIME, "").c_str());
}

bool Tcam::getChargingStatus(RemoteBookChrgnInfo& info) {
    ALOGI("%s", __func__);
    bool result = false;
    std::string startTimeProperty = android::base::GetProperty(START_TIME, "");
    std::string stopTimeProperty = android::base::GetProperty(STOP_TIME, "");
    ALOGV("ChrgnInfo startTime [%s]", startTimeProperty.c_str());
    ALOGV("ChrgnInfo stopTime [%s]", stopTimeProperty.c_str());
    if (startTimeProperty.length() != TIME_DEFAULT && stopTimeProperty.length() != TIME_DEFAULT) {
        std::vector<std::string> startTime = android::base::Split(startTimeProperty, ".");
        std::vector<std::string> stopTime = android::base::Split(stopTimeProperty, ".");
        info.startTime.year = std::stoi(startTime[0].c_str());
        info.startTime.month = std::stoi(startTime[1].c_str());
        info.startTime.day = std::stoi(startTime[2].c_str());
        info.startTime.hour = std::stoi(startTime[3].c_str());
        info.startTime.minute = std::stoi(startTime[4].c_str());
        info.startTime.second = std::stoi(startTime[5].c_str());
        info.stopTime.year = std::stoi(stopTime[0].c_str());
        info.stopTime.month = std::stoi(stopTime[1].c_str());
        info.stopTime.day = std::stoi(stopTime[2].c_str());
        info.stopTime.hour = std::stoi(stopTime[3].c_str());
        info.stopTime.minute = std::stoi(stopTime[4].c_str());
        info.stopTime.second = std::stoi(stopTime[5].c_str());

        long switchStatus = android::base::GetIntProperty(SWITCH_STATUS, TIME_DEFAULT);

        if (switchStatus == 0) {
            info.remoteBookChrgn = RemoteBookChrgn::OFF;
        } else if (switchStatus == 1) {
            info.remoteBookChrgn = RemoteBookChrgn::On;
        }
        result = true;
    }

    return result;
}

Return<StatusCode> Tcam::setBookTravel(const BookTravelGetResponse& setBookTravelInfo) {
    ALOGD("%s: Start !", __func__);
    auto task = [setBookTravelInfo, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpBookTravelSet_SetRequest data;

        data.bookTravelSet.m.bookTravelCycleSwitchPresent = 1;
        if (SwtSts::on == setBookTravelInfo.bookTravelSwitch) {
            data.bookTravelSet.bookTravelCycleSwitch = ::SwtSts::on;
        } else if (SwtSts::off == setBookTravelInfo.bookTravelSwitch) {
            data.bookTravelSet.bookTravelCycleSwitch = ::SwtSts::off;
        }
        ALOGD("setBookTravel: bookTravelCycleSwitch: %d",
            data.bookTravelSet.bookTravelCycleSwitch);

        data.bookTravelSet.m.bookTravelOneDaySetPresent = 1;
        ASN1C_BookTravelSet_bookTravelOneDaySet bookTravelOneDaySetlist(
            data.bookTravelSet.bookTravelOneDaySet);

        DateTime travelDefTime;
        travelDefTime.dataOrTi = DateOrTime::Ti;
        travelDefTime.year = 2000;
        travelDefTime.month = 1;
        travelDefTime.day = 1;
        travelDefTime.hour = 0;
        travelDefTime.minute = 0;
        travelDefTime.second = 0;

        for (int i = 1; i < 8; i++) {
            ASN1T_BookTravelSet_BookTravelOneDaySet* bookTravelOneDaySet =
                bookTravelOneDaySetlist.AppendNewElement();

            bookTravelOneDaySet->selectedSts = false;
            bookTravelOneDaySet->day = i;

            Utils::DateTime2Asn(travelDefTime, bookTravelOneDaySet->travelTime);
        }

        for (size_t i = 0; i < setBookTravelInfo.dataList.size(); i++) {
            ASN1T_BookTravelSet_BookTravelOneDaySet* bookTravelOneDaySet =
                (ASN1T_BookTravelSet_BookTravelOneDaySet*)
                    bookTravelOneDaySetlist[(int)(setBookTravelInfo.dataList[i].day) - 1];

            // ALOGD("bookTravelOneDaySetlist i = %zu, day = %d", i, setBookTravelInfo.dataList[i].day);

            if ((int)setBookTravelInfo.dataList[i].day <= 0 ||
                (int)setBookTravelInfo.dataList[i].day > 7) {
                ALOGW("BookTravelOneDaySet param err day = %d", setBookTravelInfo.dataList[i].day);
                continue;
            }

            if (SelectedStatus::off == setBookTravelInfo.dataList[i].selectedStatus) {
                bookTravelOneDaySet->selectedSts = false;
            } else if (SelectedStatus::on == setBookTravelInfo.dataList[i].selectedStatus) {
                bookTravelOneDaySet->selectedSts = true;
            }
            // ALOGD("%s: i[%zu] selectedSts[%d] day=%d!", __func__, i,
            //       bookTravelOneDaySet->selectedSts, setBookTravelInfo.dataList[i].day);
            Utils::DateTime2Asn(setBookTravelInfo.dataList[i].travelTime,
                                bookTravelOneDaySet->travelTime);
            // ALOGD("%s: i[%zu] year[%d] month[%d] day[%d] hour[%d] minute[%d] second[%d]!", __func__,
            //       i, bookTravelOneDaySet->travelTime.year, bookTravelOneDaySet->travelTime.month,
            //       bookTravelOneDaySet->travelTime.day, bookTravelOneDaySet->travelTime.hour,
            //       bookTravelOneDaySet->travelTime.minute, bookTravelOneDaySet->travelTime.second);
            ALOGD("setBookTravel: DailyTravel:         %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d  Week(1~7): %d  Selected: %d",
                bookTravelOneDaySet->travelTime.year, bookTravelOneDaySet->travelTime.month,
                bookTravelOneDaySet->travelTime.day, bookTravelOneDaySet->travelTime.hour,
                bookTravelOneDaySet->travelTime.minute, bookTravelOneDaySet->travelTime.second,
                bookTravelOneDaySet->travelTime.dateOrTime,
                bookTravelOneDaySet->day, bookTravelOneDaySet->selectedSts);
        }

        data.bookTravelSet.m.bookTravelChargeValleyTimeSwitchPresent = 1;
        if (SwtSts::on == setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch) {
            data.bookTravelSet.bookTravelChargeValleyTimeSwitch = ::SwtSts::on;
        } else if (SwtSts::off == setBookTravelInfo.bookTravelChargeValleyTimeSet.valleyTimeSwitch) {
            data.bookTravelSet.bookTravelChargeValleyTimeSwitch = ::SwtSts::off;
        } else {
            data.bookTravelSet.m.bookTravelChargeValleyTimeSwitchPresent = 0;
        }
        Utils::DateTime2Asn(setBookTravelInfo.bookTravelChargeValleyTimeSet.startValleyTime,
                            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start);
        Utils::DateTime2Asn(setBookTravelInfo.bookTravelChargeValleyTimeSet.stopValleyTime,
                            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End);
        ALOGD("setBookTravel: ValleyTime_Start:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.year,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.month,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.day,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.hour,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.minute,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.second,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_Start.dateOrTime);
        ALOGD("setBookTravel: ValleyTime_End:      %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.year,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.month,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.day,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.hour,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.minute,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.second,
            data.bookTravelSet.bookTravelChargeValleyTimeSet.valleyTime_End.dateOrTime);

        data.bookTravelSet.m.bookTravelTemporarySetPresent = 1;
        if (SwtSts::on == setBookTravelInfo.bookTravelTemporarySet.temporarySwitch) {
            data.bookTravelSet.bookTravelTemporarySet.temporarySwitch = ::SwtSts::on;
        } else if (SwtSts::off == setBookTravelInfo.bookTravelTemporarySet.temporarySwitch) {
            data.bookTravelSet.bookTravelTemporarySet.temporarySwitch = ::SwtSts::off;
        } else {
            data.bookTravelSet.m.bookTravelTemporarySetPresent = 0;
        }
        Utils::DateTime2Asn(setBookTravelInfo.bookTravelTemporarySet.temporaryTravelTime,
                            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime);
        ALOGD("setBookTravel: TemporaryTravelTime: %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.year,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.month,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.day,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.hour,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.minute,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.second,
            data.bookTravelSet.bookTravelTemporarySet.temporaryTravelTime.dateOrTime);

        data.bookTravelSet.m.battPreHeatgActvdStsPresent = 1;
        if (SwtSts::on == setBookTravelInfo.battPreHeatgActvdSts) {
            data.bookTravelSet.battPreHeatgActvdSts = ::SwtSts::on;
        } else if (SwtSts::off == setBookTravelInfo.battPreHeatgActvdSts) {
            data.bookTravelSet.battPreHeatgActvdSts = ::SwtSts::off;
        } else {
            data.bookTravelSet.m.battPreHeatgActvdStsPresent = 0;
        }

        data.bookTravelSet.m.battPreHeatgLvlPresent = 1;
        if (BattPreHeatgLvl::eco == setBookTravelInfo.battPreHeatgLvl) {
            data.bookTravelSet.battPreHeatgLvl = ::BattPreHeatgLvl::eco;
        } else if (BattPreHeatgLvl::notActive == setBookTravelInfo.battPreHeatgLvl) {
            data.bookTravelSet.battPreHeatgLvl = ::BattPreHeatgLvl::not_Active;
        } else if (BattPreHeatgLvl::sport == setBookTravelInfo.battPreHeatgLvl) {
            data.bookTravelSet.battPreHeatgLvl = ::BattPreHeatgLvl::sport;
        } else {
            data.bookTravelSet.m.battPreHeatgLvlPresent = 0;
        }

        data.bookTravelSet.m.bookTrvlClimaActvdStsPresent = 1;
        if (SwtSts::on == setBookTravelInfo.bookTrvlClimaActvdSts) {
            data.bookTravelSet.bookTrvlClimaActvdSts = ::SwtSts::on;
        } else if (SwtSts::off == setBookTravelInfo.bookTrvlClimaActvdSts) {
            data.bookTravelSet.bookTrvlClimaActvdSts = ::SwtSts::off;
        } else {
            data.bookTravelSet.m.bookTrvlClimaActvdStsPresent = 0;
        }

        ALOGD(
            "setBookTravel:  bookTravelCycleSwitch:%d TemporarySwitch:%d BattPreHeatgActvdSts:%d "
            "BattPreHeatgLvl:%d BookTrvlClimaActvdSts:%d !",
            data.bookTravelSet.bookTravelCycleSwitch,
            data.bookTravelSet.bookTravelTemporarySet.temporarySwitch,
            data.bookTravelSet.battPreHeatgActvdSts,
            data.bookTravelSet.battPreHeatgLvl,
            data.bookTravelSet.bookTrvlClimaActvdSts);

        setBookTravelResourceGroup();

        ASN1C_OpBookTravelSet_SetRequest OpBookTravelSet_SetRequestPDU(encodeBuffer, data);

        encodeBuffer.setTrace(true);

        OSSIZE MAXREADLEN = 8024;
        char printBuffer[MAXREADLEN];
        memset(printBuffer, 0, MAXREADLEN);
        OpBookTravelSet_SetRequestPDU.toString(printBuffer, MAXREADLEN);
        ALOGD("%s", printBuffer);
        ALOGD("%s", &printBuffer[1023]);
        ALOGD("%s\n", &printBuffer[2047]);

        if (ENCODE_SUCCESS == (stat = OpBookTravelSet_SetRequestPDU.Encode())) {
            ALOGV("setBookTravel: OpBookTravelSet_SetRequestPDU encode success");
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_BOOK_TRAVEL, OP_ID_BOOK_TRAVEL_SET, OP_TYPE_SET_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_book_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("setBookTravel: OpBookTravelSet_SetRequest ipcp send err : %d", err);
            } else {
                ALOGV("setBookTravel: OpBookTravelSet_SetRequest ipcp send success");
            }
        } else {
            ALOGE("OpBookTravelSet_SetRequest encode failed(%d) %s\n", stat,
                  encodeBuffer.getMsgCopy());
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    ALOGD("%s: End !", __func__);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestBookTravel(BookTravelGet bookTravelGet) {
    auto task = [bookTravelGet, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpBookTravelGet_Request data;
        if (BookTravelGet::defaultValue == bookTravelGet) {
            data.bookTravelGet = ::BookTravelGet::default_;
        } else if (BookTravelGet::bookTravelGet == bookTravelGet) {
            data.bookTravelGet = ::BookTravelGet::bookTravelGet;
        }
        setBookTravelResourceGroup();
        ASN1C_OpBookTravelGet_Request OpBookTravelGet_RequestPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpBookTravelGet_RequestPDU.Encode())) {
        ALOGV("requestBookTravel: OpBookTravelGet_RequestPDU encode success");
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_BOOK_TRAVEL, OP_ID_BOOK_TRAVEL_GET, OP_TYPE_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_book_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: OpBookTravelGet_Request ipcp send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("requestBookTravel: OpBookTravelGet_Request ipcp send success");
            }
        } else {
            ALOGE("OpBookTravelGet_Request encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::setBookCharging_Use0x22(const BookChargingGetResponse& bookChargingGetResponse) {
    ALOGD("%s: Start !", __func__);
    auto task = [bookChargingGetResponse, this]() {

        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpReservationChrgnSet_SetRequest data;

        ALOGD("setBookCharging_Use0x22: reservationChrgnSwitchSts: %d", bookChargingGetResponse.reservationChrgnSwitchSts);
        if (ReservationChrgnSwitchSts::single == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::single;
        } else if (ReservationChrgnSwitchSts::cycle == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::cycle;
        } else if (ReservationChrgnSwitchSts::off == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::off;
        }

        ALOGD("setBookCharging_Use0x22: reservationStrtTiChrgnTmrPresent: %d", bookChargingGetResponse.reservationStrtTiChrgnTmrPresent);
        ALOGD("setBookCharging_Use0x22: reservationStopTiChrgnTmrPresent: %d", bookChargingGetResponse.reservationStopTiChrgnTmrPresent);
        ALOGD("setBookCharging_Use0x22: priorityFullSwitchStsPresent: %d", bookChargingGetResponse.priorityFullSwitchStsPresent);
        ALOGD("setBookCharging_Use0x22: plugInChrgnSwitchStsPresent: %d", bookChargingGetResponse.plugInChrgnSwitchStsPresent);

        data.m.reservationStrtTiChrgnTmrPresent = bookChargingGetResponse.reservationStrtTiChrgnTmrPresent;
        data.m.reservationStopTiChrgnTmrPresent = bookChargingGetResponse.reservationStopTiChrgnTmrPresent;
        data.m.priorityFullSwitchStsPresent = bookChargingGetResponse.priorityFullSwitchStsPresent;
        data.m.plugInChrgnSwitchStsPresent = bookChargingGetResponse.plugInChrgnSwitchStsPresent;

        Utils::DateTime2Asn(bookChargingGetResponse.reservationStrtTiChrgnTmr,
                            data.reservationStrtTiChrgnTmr);
        Utils::DateTime2Asn(bookChargingGetResponse.reservationStopTiChrgnTmr,
                            data.reservationStopTiChrgnTmr);
        ALOGD("setBookCharging_Use0x22: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.reservationStrtTiChrgnTmr.year,
            data.reservationStrtTiChrgnTmr.month,
            data.reservationStrtTiChrgnTmr.day,
            data.reservationStrtTiChrgnTmr.hour,
            data.reservationStrtTiChrgnTmr.minute,
            data.reservationStrtTiChrgnTmr.second,
            data.reservationStrtTiChrgnTmr.dateOrTime);
        ALOGD("setBookCharging_Use0x22: reservationStopTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.reservationStopTiChrgnTmr.year,
            data.reservationStopTiChrgnTmr.month,
            data.reservationStopTiChrgnTmr.day,
            data.reservationStopTiChrgnTmr.hour,
            data.reservationStopTiChrgnTmr.minute,
            data.reservationStopTiChrgnTmr.second,
            data.reservationStopTiChrgnTmr.dateOrTime);

        if (SwtSts::on == bookChargingGetResponse.priorityFullSwitchSts) {
            data.priorityFullSwitchSts = ::SwtSts::on;
        } else if (SwtSts::off == bookChargingGetResponse.priorityFullSwitchSts) {
            data.priorityFullSwitchSts = ::SwtSts::off;
        } else {
            data.m.priorityFullSwitchStsPresent = 0;
        }

        if (SwtSts::on == bookChargingGetResponse.plugInChrgnSwitchSts) {
            data.plugInChrgnSwitchSts = ::SwtSts::on;
        } else if (SwtSts::off == bookChargingGetResponse.plugInChrgnSwitchSts) {
            data.plugInChrgnSwitchSts = ::SwtSts::off;
        } else {
            data.m.plugInChrgnSwitchStsPresent = 0;
        }

        ALOGD("setBookCharging_Use0x22:  priorityFullSwitchSts:%d plugInChrgnSwitchSts:%d ",
            data.priorityFullSwitchSts, data.plugInChrgnSwitchSts);

        setChargingResourceGroup();

        ASN1C_OpReservationChrgnSet_SetRequest OpReservationChrgnSet_SetRequestPDU(encodeBuffer, data);

        encodeBuffer.setTrace(true);

        OSSIZE MAXREADLEN = 8024;
        char printBuffer[MAXREADLEN];
        memset(printBuffer, 0, MAXREADLEN);
        OpReservationChrgnSet_SetRequestPDU.toString(printBuffer, MAXREADLEN);
        ALOGD("%s", printBuffer);
        ALOGD("%s", &printBuffer[1023]);
        ALOGD("%s\n", &printBuffer[2047]);

        if (ENCODE_SUCCESS == (stat = OpReservationChrgnSet_SetRequestPDU.Encode())) {
            ALOGV("setBookCharging_Use0x22: OpReservationChrgnSet_SetRequestPDU encode success");
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_RESERVATION_CHRGN_SET, OP_TYPE_SET_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("setBookCharging_Use0x22: OpReservationChrgnSet_SetRequest ipcp send err : %d", err);
            } else {
                ALOGV("setBookCharging_Use0x22: OpReservationChrgnSet_SetRequest ipcp send success");
            }
        } else {
            ALOGE("OpReservationChrgnSet_SetRequest encode failed(%d) %s\n", stat,
                  encodeBuffer.getMsgCopy());
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    ALOGD("%s: End !", __func__);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::setBookCharging_Use0x1C(const BookChargingGetResponse& bookChargingGetResponse) {
    ALOGD("%s: Start !", __func__);
    auto task = [bookChargingGetResponse, this]() {

        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpLocalReservationChrgnSet_SetRequest data;

        ALOGD("setBookCharging_Use0x1C: reservationChrgnSwitchSts: %d", bookChargingGetResponse.reservationChrgnSwitchSts);
        if (ReservationChrgnSwitchSts::single == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::single;
        } else if (ReservationChrgnSwitchSts::cycle == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::cycle;
        } else if (ReservationChrgnSwitchSts::off == bookChargingGetResponse.reservationChrgnSwitchSts) {
            data.reservationChrgnSwitchSts = ::ReservationChrgnSet_ReservationChrgnSwitchSts::off;
        }

        ALOGD("setBookCharging_Use0x1C: reservationStrtTiChrgnTmrPresent: %d", bookChargingGetResponse.reservationStrtTiChrgnTmrPresent);
        ALOGD("setBookCharging_Use0x1C: reservationStopTiChrgnTmrPresent: %d", bookChargingGetResponse.reservationStopTiChrgnTmrPresent);
        ALOGD("setBookCharging_Use0x1C: priorityFullSwitchStsPresent: %d", bookChargingGetResponse.priorityFullSwitchStsPresent);

        data.m.reservationStrtTiChrgnTmrPresent = bookChargingGetResponse.reservationStrtTiChrgnTmrPresent;
        data.m.reservationStopTiChrgnTmrPresent = bookChargingGetResponse.reservationStopTiChrgnTmrPresent;
        data.m.priorityFullSwitchStsPresent = bookChargingGetResponse.priorityFullSwitchStsPresent;

        Utils::DateTime2Asn(bookChargingGetResponse.reservationStrtTiChrgnTmr,
                            data.reservationStrtTiChrgnTmr);
        Utils::DateTime2Asn(bookChargingGetResponse.reservationStopTiChrgnTmr,
                            data.reservationStopTiChrgnTmr);
        ALOGD("setBookCharging_Use0x1C: reservationStrtTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.reservationStrtTiChrgnTmr.year,
            data.reservationStrtTiChrgnTmr.month,
            data.reservationStrtTiChrgnTmr.day,
            data.reservationStrtTiChrgnTmr.hour,
            data.reservationStrtTiChrgnTmr.minute,
            data.reservationStrtTiChrgnTmr.second,
            data.reservationStrtTiChrgnTmr.dateOrTime);
        ALOGD("setBookCharging_Use0x1C: reservationStopTiChrgnTmr:    %d-%02d-%02d  %02d:%02d:%02d  DataOrTi: %d",
            data.reservationStopTiChrgnTmr.year,
            data.reservationStopTiChrgnTmr.month,
            data.reservationStopTiChrgnTmr.day,
            data.reservationStopTiChrgnTmr.hour,
            data.reservationStopTiChrgnTmr.minute,
            data.reservationStopTiChrgnTmr.second,
            data.reservationStopTiChrgnTmr.dateOrTime);

        if (SwtSts::on == bookChargingGetResponse.priorityFullSwitchSts) {
            data.priorityFullSwitchSts = ::SwtSts::on;
        } else if (SwtSts::off == bookChargingGetResponse.priorityFullSwitchSts) {
            data.priorityFullSwitchSts = ::SwtSts::off;
        } else {
            data.m.priorityFullSwitchStsPresent = 0;
        }

        ALOGD("setBookCharging_Use0x1C:  priorityFullSwitchSts:%d ", data.priorityFullSwitchSts);

        setChargingResourceGroup();

        ASN1C_OpLocalReservationChrgnSet_SetRequest OpLocalReservationChrgnSet_SetRequestPDU(encodeBuffer, data);

        encodeBuffer.setTrace(true);

        OSSIZE MAXREADLEN = 8024;
        char printBuffer[MAXREADLEN];
        memset(printBuffer, 0, MAXREADLEN);
        OpLocalReservationChrgnSet_SetRequestPDU.toString(printBuffer, MAXREADLEN);
        ALOGD("%s", printBuffer);
        ALOGD("%s", &printBuffer[1023]);
        ALOGD("%s\n", &printBuffer[2047]);

        if (ENCODE_SUCCESS == (stat = OpLocalReservationChrgnSet_SetRequestPDU.Encode())) {
            ALOGV("setBookCharging_Use0x1C: OpLocalReservationChrgnSet_SetRequestPDU encode success");
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_LOCAL_RESERVATION_CHRGN_SET, OP_TYPE_SET_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("setBookCharging_Use0x1C: OpLocalReservationChrgnSet_SetRequest ipcp send err : %d", err);
            } else {
                ALOGV("setBookCharging_Use0x1C: OpLocalReservationChrgnSet_SetRequest ipcp send success");
            }
        } else {
            ALOGE("OpLocalReservationChrgnSet_SetRequest encode failed(%d) %s\n", stat,
                  encodeBuffer.getMsgCopy());
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    ALOGD("%s: End !", __func__);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestChargeInfo(SettingParamsRequest settingParamsRequest) {
    auto task = [settingParamsRequest, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpSettingParamsRequest_Request data;
        if (SettingParamsRequest::defaultValue == settingParamsRequest) {
            data.settingParamsRequest = ::SettingParamsRequest::default_;
        } else if (SettingParamsRequest::reserveCharging == settingParamsRequest) {
            data.settingParamsRequest = ::SettingParamsRequest::reserveCharging;
        }
        ASN1C_OpSettingParamsRequest_Request OpSettingParamsRequest_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpSettingParamsRequest_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setChargingResourceGroup();
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_REQUESTCHRGN,
                                  OP_TYPE_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
            ALOGV("OpSettingParamsRequest_Request encode success");
        } else {
            ALOGE("OpSettingParamsRequest_Request encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);

    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestBookChargeInfo_Use0x23(BookChargingGet bookChargingGet) {
    auto task = [bookChargingGet, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpRemoteReservationChrgnSetgGet_Request data;
        if (BookChargingGet::defaultvalue == bookChargingGet) {
            data.reservationChrgnSetgGet = ::ReservationChrgnSetgGet::default_;
        } else if (BookChargingGet::setgGet == bookChargingGet) {
            data.reservationChrgnSetgGet = ::ReservationChrgnSetgGet::setgGet;
        }
        ASN1C_OpRemoteReservationChrgnSetgGet_Request OpRemoteReservationChrgnSetgGet_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpRemoteReservationChrgnSetgGet_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setChargingResourceGroup();
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_REMOTE_RESERVATION_CHRGN_SETG_GET,
                                  OP_TYPE_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
            ALOGV("OpRemoteReservationChrgnSetgGet_Request encode success");
        } else {
            ALOGE("OpRemoteReservationChrgnSetgGet_Request encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);

    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestBookChargeInfo_Use0x1D(BookChargingGet bookChargingGet) {
    auto task = [bookChargingGet, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_OpReservationChrgnSetgGet_Request data;
        if (BookChargingGet::defaultvalue == bookChargingGet) {
            data.reservationChrgnSetgGet = ::ReservationChrgnSetgGet::default_;
        } else if (BookChargingGet::setgGet == bookChargingGet) {
            data.reservationChrgnSetgGet = ::ReservationChrgnSetgGet::setgGet;
        }
        ASN1C_OpReservationChrgnSetgGet_Request OpReservationChrgnSetgGet_RequestPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpReservationChrgnSetgGet_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setChargingResourceGroup();
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_ELECTRICALPOWER, OP_ID_ELECTRICALPOWER_RESERVATION_CHARGN_SETG_GET,
                                  OP_TYPE_REQUEST, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_electricpower_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
            ALOGV("OpReservationChrgnSetgGet_Request encode success");
        } else {
            ALOGE("OpReservationChrgnSetgGet_Request encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);

    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responsePlayChatVideoLiveview(RemoteChatVideoComResp remoteChatVideoComResp) {
    ALOGI("%s", __func__);
    auto task = [remoteChatVideoComResp, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response data;
        if (RemoteChatVideoComResp::noError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::noError;
        } else if (RemoteChatVideoComResp::unableToPlaychatVideoLiveview == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::unableToPlaychatVideoLiveview;
        } else if (RemoteChatVideoComResp::cameraError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::cameraError;
        } else if (RemoteChatVideoComResp::unknownError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::unknownError;
        }
        ASN1C_VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response VehicleVideoByChatCamera_OpRemoteChatVideoComResp_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = VehicleVideoByChatCamera_OpRemoteChatVideoComResp_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setVehicleVideoResourceGroup();
            ALOGV("VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();

            ipcp_packet_t* packet = build_ipcp_response(
                SERVICE_ID_VEHICLE_VIDEO_BY_CHAT_CAMERA, OP_ID_PLAY_CHAT_VIDEO_LIVEVIEW, mPlayChatVideoHandleId,
                IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_vehiclevideo_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responseStopChatVideoLiveview(RemoteChatVideoComResp remoteChatVideoComResp) {
    ALOGI("%s", __func__);
    auto task = [remoteChatVideoComResp, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1T_VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response data;
        if (RemoteChatVideoComResp::noError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::noError;
        } else if (RemoteChatVideoComResp::unableToPlaychatVideoLiveview == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::unableToPlaychatVideoLiveview;
        } else if (RemoteChatVideoComResp::cameraError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::cameraError;
        } else if (RemoteChatVideoComResp::unknownError == remoteChatVideoComResp) {
            data.remoteChatVideoComResp = ::VehicleVideoByChatCamera_RemoteChatVideoComResp::unknownError;
        }
        ASN1C_VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response VehicleVideoByChatCamera_OpRemoteChatVideoComResp_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = VehicleVideoByChatCamera_OpRemoteChatVideoComResp_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            if (mIVehicle == nullptr) {
                init_vehicle_server();
            }
            setVehicleVideoResourceGroup();
            ALOGV("VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();

            ipcp_packet_t* packet = build_ipcp_response(
                SERVICE_ID_VEHICLE_VIDEO_BY_CHAT_CAMERA, OP_ID_STOP_CHAT_VIDEO_LIVEVIEW, mStopChatVideoHandleId,
                IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_vehiclevideo_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("VehicleVideoByChatCamera_OpRemoteChatVideoComResp_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyRemoteChatVideoTimeOut() {
    ALOGI("%s", __func__);
    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_VEHICLE_VIDEO_BY_CHAT_CAMERA, OP_ID_REMOTE_CHAT_VIDEO_TIMEOUT,
                                  OP_TYPE_NOTIFICATION, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_vehiclevideo_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifyRemoteChatVideoTiOutNotif() {
    ALOGI("%s", __func__);
    auto task = []() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);
        ASN1C_OpGeneric_Request OpGeneric_RequestPDU(encodeBuffer);
        if (ENCODE_SUCCESS == (stat = OpGeneric_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpGeneric_RequestPDU encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_VEHICLE_VIDEO_BY_CHAT_CAMERA, OP_ID_REMOTE_CHAT_VIDEO_TIOUT_NOTIF,
                                  OP_TYPE_NOTIFICATION, IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_vehiclevideo_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpGeneric_RequestPDU encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestSecRowFaceRecognitionReq(SecRowFaceInfoReq secRowFaceInfoReq, const hidl_string& secRowFaceInfoReqGID) {
    ALOGI("%s", __func__);
    auto task = [secRowFaceInfoReq, secRowFaceInfoReqGID, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_OpSecRowFaceRecognitionReq_SetRequestNoReturn data;
        data.secRowFaceInfoReq = ProfID::Root(secRowFaceInfoReq);
        data.secRowFaceInfoReqGID = secRowFaceInfoReqGID.c_str();
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setSecRowFacialRecognitionResourceGroup();
        ASN1C_OpSecRowFaceRecognitionReq_SetRequestNoReturn OpSecRowFaceRecognitionReq_SetRequestNoReturnPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = OpSecRowFaceRecognitionReq_SetRequestNoReturnPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpSecRowFaceRecognitionReq_SetRequestNoReturn encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION, OP_ID_SEC_ROW_FACE_RECOGNITION_REQ, OP_TYPE_SET_REQUEST_NO_RETURN,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_sec_row_facial_recognition_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpSecRowFaceRecognitionReq_SetRequestNoReturn encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifySecRowFaceRegister(const hidl_string& secRowFaceInfoAcqGid, const hidl_string& secRowfaceInfoAcqImg) {
    ALOGI("%s", __func__);
    auto task = [secRowFaceInfoAcqGid, secRowfaceInfoAcqImg, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_OpSecRowFaceRegister_Notification data;
        data.secRowFaceInfoAcqGid = secRowFaceInfoAcqGid.c_str();
        data.secRowfaceInfoAcqImg = secRowfaceInfoAcqImg.c_str();
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setSecRowFacialRecognitionResourceGroup();
        ASN1C_OpSecRowFaceRegister_Notification ASN1C_OpSecRowFaceRegister_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = ASN1C_OpSecRowFaceRegister_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpSecRowFaceRegister_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION, OP_ID_SEC_ROW_FACE_REGISTER, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_sec_row_facial_recognition_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpSecRowFaceRegister_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::requestSecRowFaceSgnInPictureRe(const hidl_string& secondRowfaceInfosynImg) {
    ALOGI("%s", __func__);
    auto task = [secondRowfaceInfosynImg, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_OpSecRowFaceSgnInPictureRe_Request data;
        data.secondRowfaceInfosynImg = secondRowfaceInfosynImg.c_str();
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setSecRowFacialRecognitionResourceGroup();
        ASN1C_OpSecRowFaceSgnInPictureRe_Request ASN1C_OpSecRowFaceSgnInPictureRe_RequestPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = ASN1C_OpSecRowFaceSgnInPictureRe_RequestPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpSecRowFaceSgnInPictureRe_Request encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION, OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_RE, OP_TYPE_SET_REQUEST,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_dmm_sec_row_facial_recognition_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpSecRowFaceSgnInPictureRe_Request encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::notifySecRowFaceInfoCnclGid(const hidl_string& secRowFaceInfoCnclGid) {
    ALOGI("%s", __func__);
    auto task = [secRowFaceInfoCnclGid, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_OpSecRowFaceInfoCnclGid_Notification data;
        data.secRowFaceInfoCnclGid = (OSUTF8CHAR*)secRowFaceInfoCnclGid.c_str();
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setSecRowFacialRecognitionResourceGroup();
        ASN1C_OpSecRowFaceInfoCnclGid_Notification ASN1C_OpSecRowFaceInfoCnclGid_NotificationPDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = ASN1C_OpSecRowFaceInfoCnclGid_NotificationPDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpSecRowFaceInfoCnclGid_Notification encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION, OP_ID_SEC_ROW_FACE_INFO_CNCL_GID, OP_TYPE_NOTIFICATION,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_sec_row_facial_recognition_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpSecRowFaceInfoCnclGid_Notification encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

Return<StatusCode> Tcam::responseSecRowFaceSgnInPictureCenter(FirstRowfaceInfosynSts firstRowfaceInfosynSts) {
    ALOGI("%s", __func__);
    auto task = [firstRowfaceInfosynSts, this]() {
        const char* content = nullptr;
        int stat, len;
        bool trace = FALSE;
        ipcp_stack_err_t err;
        ASN1PEREncodeBuffer encodeBuffer(false);

        ASN1T_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_Response data;
        if (FirstRowfaceInfosynSts::fail == firstRowfaceInfosynSts) {
            data.secondRowfaceInfosynSts = ::FirstRowfaceInfosynSts::fail;
        } else if (FirstRowfaceInfosynSts::success == firstRowfaceInfosynSts) {
            data.secondRowfaceInfosynSts = ::FirstRowfaceInfosynSts::success;
        }
        if (mIVehicle == nullptr) {
            init_vehicle_server();
        }
        setSecRowFacialRecognitionResourceGroup();
        ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_Response ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_ResponsePDU(encodeBuffer, data);
        if (ENCODE_SUCCESS == (stat = ASN1C_SecRowFacialRecognition_OpSecRowFaceSgnInPictureCenter_ResponsePDU.Encode())) {
            if (trace) {
                ALOGV("Encoding was successful\n");
                ALOGV("Hex dump of encoded record:\n");
                encodeBuffer.hexDump();
                ALOGV("Binary dump:\n");
                encodeBuffer.binDump("Data");
            }
            ALOGV("OpSecRowFaceSgnInPictureCenter_Response encode success");
            len = encodeBuffer.getMsgLen();
            content = (char*)encodeBuffer.getMsgPtr();
            ipcp_packet_t* packet =
                build_ipcp_packet(SERVICE_ID_SEC_ROW_FACIAL_RECOGNITION, OP_ID_SEC_ROW_FACE_SGN_IN_PICTURE_CENTER, OP_TYPE_RESPONSE,
                                  IPCP_DATA_ENCODED, (void*)content, len);
            if ((err = ipcp_send(peer_dmm_sec_row_facial_recognition_server, packet)) != STACK_SEND_MSG_SUCCESS) {
                ALOGE("%s: ipcp_send err : %d", __FUNCTION__, err);
            } else {
                ALOGV("%s: ipcp send success", __FUNCTION__);
            }
        } else {
            ALOGE("OpSecRowFaceSgnInPictureCenter_Response encode failed\n");
            encodeBuffer.printErrorInfo();
        }
    };
    mThread.schedule(task, gDefaultDelay.common);
    return StatusCode::SUCCESS;
}

}  // namespace V1_0
}  // namespace tcam
}  // namespace xma
}  // namespace ecarx
}  // namespace vendor
